:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --border-color: #dee2e6;
    --shadow: 0 5px 15px rgba(0,0,0,0.08);
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --light-color: #343a40;
    --dark-color: #f8f9fa;
    --border-color: #495057;
    --shadow: 0 5px 15px rgba(0,0,0,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--dark-color);
    transition: var(--transition);
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: slideUp 0.5s ease;
}

[data-theme="dark"] .login-card {
    background: #2c3e50;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 30px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-header:before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255,255,255,0.1);
    transform: rotate(45deg);
}

.school-logo {
    position: relative;
    z-index: 1;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    color: var(--primary-color);
    font-size: 24px;
}

.school-name {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 5px;
}

.school-motto {
    font-size: 14px;
    opacity: 0.9;
}

.login-body {
    padding: 30px 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

[data-theme="dark"] .form-label {
    color: #e9ecef;
}

.input-group {
    position: relative;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    background: var(--light-color);
    color: var(--dark-color);
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--secondary-color);
}

.role-selector {
    margin-bottom: 25px;
}

.role-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.role-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--light-color);
    color: var(--dark-color);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    min-width: 80px;
    font-size: 14px;
}

.role-btn i {
    display: block;
    margin-bottom: 5px;
    font-size: 18px;
}

.role-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 14px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--dark-color);
}

.checkbox-label input {
    width: 16px;
    height: 16px;
}

.forgot-link {
    color: var(--dark-color);
    text-decoration: none;
    transition: var(--transition);
}

.forgot-link:hover {
    text-decoration: underline;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-footer {
    padding: 20px 25px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: #6c757d;
    font-size: 14px;
}

.login-footer a {
    color: var(--dark-color);
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Theme Toggle */
.theme-toggle-container {
    position: absolute;
    top: 20px;
    right: 20px;
}

.theme-toggle {
    width: 40px;
    height: 20px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

[data-theme="dark"] .theme-toggle:before {
    left: 22px;
}

/* Alert Messages */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Demo Button */
.demo-btn {
    margin-top: 15px;
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.demo-btn:hover {
    background: rgba(52, 152, 219, 0.1);
}

/* Responsive */
@media (max-width: 576px) {
    .login-card {
        margin: 10px;
    }
    
    .login-body {
        padding: 20px 15px;
    }
    
    .role-buttons {
        flex-direction: column;
    }
    
    .remember-forgot {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

@media (max-height: 600px) {
    body {
        align-items: flex-start;
        padding-top: 40px;
        padding-bottom: 40px;
    }
}

/* Simple Animation */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}