/* LMS Styles - Ewha Srang School */

:root {
    --primary: #4A90A4;
    --primary-dark: #3a7a8a;
    --secondary: #2c3e50;
    --accent: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --bg-light: #f8f9fa;
    --bg-dark: #1a252f;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 260px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
}

.login-header h1 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-dark);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 164, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, transform 0.1s;
}

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

.btn-login:active {
    transform: scale(0.98);
}

.error-message {
    color: var(--accent);
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.login-footer .home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 10px 20px;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.login-footer .home-btn:hover {
    background: var(--primary);
    color: white;
}

.login-footer .home-btn svg {
    flex-shrink: 0;
}

/* LMS Dashboard Layout */
.lms-dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.sidebar-nav .nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav .nav-item.active {
    background: var(--primary);
    color: white;
}

.sidebar-nav .nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: white;
}

.sidebar-nav .nav-item.home-link {
    background: linear-gradient(135deg, rgba(74, 144, 164, 0.4) 0%, rgba(58, 122, 138, 0.4) 100%);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    margin: 8px 12px 16px 12px;
    padding: 12px 16px;
}

.sidebar-nav .nav-item.home-link:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: rgba(255,255,255,0.3);
}

.badge {
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    display: block;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    display: block;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
    color: white;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-header {
    background: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-dark);
}

.top-header h1 {
    flex: 1;
    font-size: 1.4rem;
    color: var(--text-dark);
}

.header-actions {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Content Sections */
.content-section {
    display: none;
    padding: 24px;
    flex: 1;
}

.content-section.active {
    display: block;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.welcome-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    cursor: default;
}

.welcome-card:hover {
    transform: none;
}

.welcome-card h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.email-icon { background: rgba(74, 144, 164, 0.1); color: var(--primary); }
.compose-icon { background: rgba(39, 174, 96, 0.1); color: var(--success); }
.calendar-icon { background: rgba(243, 156, 18, 0.1); color: var(--warning); }

.dashboard-card h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.dashboard-card p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.dashboard-calendar {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.dashboard-calendar h3 {
    margin-bottom: 16px;
    color: var(--text-dark);
}

.upcoming-events {
    max-height: 300px;
    overflow-y: auto;
}

.event-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: var(--bg-light);
}

.event-date {
    background: var(--primary);
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius);
    text-align: center;
    min-width: 50px;
}

.event-date .day {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
}

.event-date .month {
    font-size: 0.7rem;
    text-transform: uppercase;
}

.event-info h4 {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.event-info p {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Inbox */
.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.password-prompt {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    margin-bottom: 20px;
}

.password-form {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.password-form input {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    width: 200px;
}

.email-list {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.email-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.email-item:last-child {
    border-bottom: none;
}

.email-item:hover {
    background: var(--bg-light);
}

.email-item.unread {
    background: rgba(74, 144, 164, 0.05);
}

.email-item.unread .email-subject {
    font-weight: 600;
}

.email-sender {
    width: 200px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-content {
    flex: 1;
    min-width: 0;
    padding: 0 16px;
}

.email-subject {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.email-preview {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-date {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
}

.empty-inbox {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-inbox svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Compose */
.compose-form {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.compose-form .form-group {
    margin-bottom: 20px;
}

.compose-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.compose-form input,
.compose-form select,
.compose-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.compose-form input:focus,
.compose-form select:focus,
.compose-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.compose-form textarea {
    resize: vertical;
    min-height: 200px;
}

.form-actions {
    display: flex;
    gap: 12px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

.message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius);
    display: none;
}

.message.success {
    display: block;
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.message.error {
    display: block;
    background: rgba(231, 76, 60, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
}

/* Calendar */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
}

.calendar-header h2 {
    min-width: 200px;
    text-align: center;
}

.btn-nav {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-nav:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.calendar-grid {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-dark);
    color: white;
}

.calendar-weekdays span {
    padding: 12px;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    min-height: 80px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-top: none;
    border-left: none;
    position: relative;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day:nth-child(7n+1) {
    border-left: none;
}

.calendar-day.other-month {
    background: var(--bg-light);
    color: var(--text-light);
}

.calendar-day.today {
    background: rgba(74, 144, 164, 0.1);
}

.calendar-day.today .day-number {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-number {
    font-weight: 500;
    margin-bottom: 4px;
}

.day-events {
    font-size: 0.75rem;
}

.day-event {
    padding: 2px 4px;
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.day-event.holiday { background: #e74c3c; color: white; }
.day-event.exam { background: #9b59b6; color: white; }
.day-event.event { background: #3498db; color: white; }
.day-event.meeting { background: #27ae60; color: white; }
.day-event.general { background: var(--primary); color: white; }

.calendar-events {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.calendar-events h3 {
    margin-bottom: 16px;
}

.event-list {
    max-height: 300px;
    overflow-y: auto;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 16px;
    background: white;
    border-radius: var(--radius);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.holiday { background: #e74c3c; }
.dot.exam { background: #9b59b6; }
.dot.event { background: #3498db; }
.dot.meeting { background: #27ae60; }

/* Settings */
.settings-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.settings-card h3 {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.settings-form .form-group {
    margin-bottom: 16px;
}

.settings-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.settings-form input {
    width: 100%;
    max-width: 300px;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
}

.settings-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.account-info p {
    margin-bottom: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px 8px;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.email-meta {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.email-meta p {
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.email-body {
    white-space: pre-wrap;
    line-height: 1.7;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Loading */
.loading {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .email-sender {
        width: 120px;
    }

    .calendar-day {
        min-height: 60px;
        padding: 4px;
    }

    .day-events {
        display: none;
    }

    .password-form {
        flex-direction: column;
        align-items: stretch;
    }

    .password-form input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 24px;
    }

    .content-section {
        padding: 16px;
    }

    .compose-form,
    .settings-card {
        padding: 16px;
    }

    .email-item {
        flex-wrap: wrap;
    }

    .email-sender {
        width: 100%;
        margin-bottom: 4px;
    }

    .email-content {
        width: 100%;
        padding: 0;
    }

    .email-date {
        margin-left: auto;
    }
}
