/* IITH Mail PWA - Styles */

:root {
    --navy: #1A2A5E;
    --navy-light: #243b7a;
    --orange: #FF6600;
    --orange-dark: #e55a00;
    --gray: #6c757d;
    --border: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #333;
    height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    background: var(--navy);
    color: white;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-area img {
    height: 30px;
    border-radius: 4px;
}

.logo-area h1 {
    font-size: 1.1rem;
    color: white;
}

.menu-toggle {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    display: none;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-area span {
    color: rgba(255,255,255,0.9);
    font-size: 0.8rem;
}

/* App Body */
.app-container-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar - Desktop */
.sidebar {
    width: 200px;
    background: white;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    gap: 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background: #f0f2f5;
}

.nav-item.active {
    background: rgba(26,42,94,0.08);
    color: var(--navy);
    border-right: 3px solid var(--navy);
    font-weight: 500;
}

.nav-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.nav-label {
    flex: 1;
}

.badge {
    background: var(--orange);
    color: white;
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 0.6rem;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

.badge-memo {
    background: #f59e0b;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f7fa;
}

.view-content {
    max-width: 900px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--navy);
    font-size: 0.95rem;
}

.card-body {
    padding: 0;
}

/* Email Items */
.email-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e8ecf0;
    cursor: pointer;
    transition: background 0.2s;
}

.email-item:hover {
    background: #f8f9fa;
}

.email-item.unread {
    background: #fff8e1;
    border-left: 3px solid #FFD700;
}

/* Forms */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray);
    margin-bottom: 4px;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e8ecf0;
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--orange);
    background: white;
    box-shadow: 0 0 0 3px rgba(255,102,0,0.08);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-orange {
    background: var(--orange);
    color: white;
}

.btn-orange:hover {
    background: var(--orange-dark);
}

.btn-outline {
    background: white;
    border: 1.5px solid #e8ecf0;
    color: #555;
}

.btn-outline:hover {
    border-color: var(--orange);
    color: var(--orange);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.75rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 10px;
    background: white;
    border-top: 1px solid var(--border);
    font-size: 0.65rem;
    color: var(--gray);
    flex-shrink: 0;
}

.app-footer a {
    color: var(--orange);
    text-decoration: none;
}

/* Mobile Navigation - Bottom Tabs */
.mobile-nav {
    display: none;
    background: white;
    border-top: 1px solid var(--border);
    padding: 6px 0 env(safe-area-inset-bottom, 8px) 0;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 50;
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    background: none;
    border: none;
    color: var(--gray);
    font-size: 0.55rem;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
}

.mobile-nav-item .nav-icon {
    font-size: 1.3rem;
    width: auto;
}

.mobile-nav-item.active {
    color: var(--orange);
}

.mobile-nav-item .badge {
    position: absolute;
    top: 0;
    right: 2px;
    font-size: 0.5rem;
    padding: 1px 6px;
    min-width: 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -220px;
        top: 56px;
        bottom: 0;
        z-index: 200;
        width: 220px;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.3);
        z-index: 150;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .mobile-nav {
        display: block;
    }
    
    .main-content {
        padding: 12px;
        padding-bottom: 70px;
    }
    
    .app-header {
        padding: 8px 12px;
    }
    
    .logo-area h1 {
        font-size: 0.95rem;
    }
    
    .view-content {
        max-width: 100%;
    }
    
    .email-item {
        padding: 10px 12px;
    }
    
    .email-item .from {
        font-size: 0.8rem;
    }
    
    .email-item .subject {
        font-size: 0.75rem;
    }
    
    .modal-content {
        margin: 12px;
        padding: 16px;
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 8px;
        padding-bottom: 65px;
    }
    
    .card-header {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .email-item {
        padding: 8px 10px;
    }
    
    .email-item .from {
        font-size: 0.75rem;
    }
    
    .email-item .subject {
        font-size: 0.7rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

/* Animations */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}
