/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
    animation: fadeIn 0.6s ease-in-out;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('image/campus.png') no-repeat center center fixed;
    background-size: cover;
    filter: blur(5px);
    z-index: 0;
}

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

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.2) 100%);
    z-index: 1;
}

/* Back to Home Button */
.back-to-home {
    position: fixed;
    top: 2rem;
    left: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 200;
    animation: slideInLeft 0.6s ease-out;
}

.back-to-home:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateX(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.back-to-home i {
    font-size: 0.95rem;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Login Container */
.login-container {
    position: relative;
    width: 100%;
    max-width: 450px;
    padding: 1rem;
    z-index: 100;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login Card */
.login-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(220, 53, 69, 0.2);
    padding: 1.5rem 2rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

/* Logo Section */
.logo-section {
    text-align: center;
    margin-bottom: 1rem;
}

/* Logo Header */
.login-header {
    text-align: center;
    margin-bottom: 1rem;
}

.login-header .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.login-header .logo-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    animation: logoFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.login-header .logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    text-shadow: none;
    letter-spacing: 1px;
}

.login-header .subtitle {
    color: #555;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3);
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.logo-circle i {
    font-size: 2.5rem;
    color: white;
}

.logo-text {
    font-size: 2rem;
    font-weight: bold;
    color: #dc3545;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
}

.logo-subtitle {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Form Header */
.form-header {
    text-align: center;
    margin-bottom: 1rem;
}

.form-header h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: 0.5px;
}

.form-header p {
    color: #6c757d;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Form Groups */
.form-group {
    margin-bottom: 1rem;
    position: relative;
}

.form-group .input-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

/* Input Groups */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group i {
    position: absolute;
    left: 0.875rem;
    color: #dc3545;
    font-size: 0.9rem;
    z-index: 2;
}

.input-group input {
    width: 100%;
    padding: 0.75rem 0.875rem 0.75rem 2.75rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
    font-weight: 500;
}

.input-group input::placeholder {
    color: #adb5bd;
    font-weight: 400;
}

.input-group input:focus {
    outline: none;
    border-color: #dc3545;
    background: white;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.input-group input:focus + .password-toggle {
    color: #dc3545;
}

/* Password Toggle Inside Input */
.password-input-group {
    position: relative;
}

.password-input-group input {
    padding-right: 3.5rem !important;
}

.password-toggle-inside {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(220, 53, 69, 0.1);
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    z-index: 3;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    margin: 0;
}

.password-toggle-inside i {
    display: block;
    line-height: 1;
    margin: 0;
    padding: 0;
    position: relative;
    left: 0.5px;
}

.password-toggle-inside:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #c82333;
    transform: translateY(-50%) scale(1.05);
}

.password-toggle-inside:active {
    transform: translateY(-50%) scale(0.95);
}

.password-toggle-inside:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

/* Old Password Toggle (keep for compatibility) */
.password-toggle {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s ease;
    z-index: 2;
}

.password-toggle:hover {
    color: #dc3545;
}

/* Role Selector */
.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

.role-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    text-align: center;
}

.role-option:hover {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
    transform: translateY(-2px);
}

.role-option.selected {
    border-color: #dc3545;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3);
}

.role-option i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #dc3545;
    transition: color 0.3s ease;
}

.role-option.selected i {
    color: white;
}

.role-option span {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
}

.remember-me input {
    margin-right: 0.5rem;
    transform: scale(1.2);
}

.forgot-password {
    color: #dc3545;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #c82333;
    text-decoration: underline;
}

/* Login Button */
/* reCAPTCHA Container */
.recaptcha-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1rem 0;
    padding: 0.5rem;
    width: 100%;
}

.recaptcha-container > div {
    transform: scale(0.95);
    transform-origin: center;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

#recaptchaWidget {
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

/* Login Button */
.login-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 10px 30px rgba(220, 53, 69, 0.4);
    margin-bottom: 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(220, 53, 69, 0.5);
    background: linear-gradient(135deg, #c82333 0%, #a71d2a 100%);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Demo Credentials */
.demo-credentials {
    background: rgba(220, 53, 69, 0.05);
    border: 1px solid rgba(220, 53, 69, 0.1);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.demo-credentials h4 {
    color: #dc3545;
    font-size: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.demo-account {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #dc3545;
}

.demo-account:last-child {
    margin-bottom: 0;
}

/* Messages */
.error-message,
.success-message {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    display: none;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    animation: slideInDown 0.4s ease-out;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-message {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: 2px solid #dc3545;
    font-weight: 600;
}

.error-message i {
    font-size: 1.3rem;
    color: white;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.success-message i {
    font-size: 1.2rem;
}

/* Field-level errors */
.field-error {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    margin-left: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.field-error::before {
    content: '⚠';
    font-size: 0.9rem;
    color: #dc3545;
    flex-shrink: 0;
}

.input-group input.error {
    border-color: #dc3545 !important;
    background: #fff5f5 !important;
    animation: shake 0.3s ease;
}

.input-group input.error:focus {
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.25) !important;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(200, 35, 51, 0.05) 100%);
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 120px;
    height: 120px;
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

.shape-3 {
    width: 60px;
    height: 60px;
    top: 80%;
    left: 20%;
    animation-delay: 4s;
}

.shape-4 {
    width: 100px;
    height: 100px;
    top: 30%;
    right: 30%;
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .back-to-home {
        top: 1rem;
        left: 1rem;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .back-to-home span {
        display: none;
    }
    
    .back-to-home i {
        margin: 0;
    }
    
    .login-container {
        padding: 1rem;
        max-width: 100%;
    }
    
    .login-card {
        padding: 2rem 1.5rem;
    }
    
    .logo-circle {
        width: 60px;
        height: 60px;
    }
    
    .logo-circle i {
        font-size: 2rem;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
    
    .role-selector {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .role-option {
        padding: 1rem;
    }
    
    .form-options {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.5rem 1rem;
    }
    
    .form-header h2 {
        font-size: 1.5rem;
    }
    
    .input-group input {
        padding: 0.875rem 0.875rem 0.875rem 2.5rem;
    }
    
    .input-group i {
        left: 0.875rem;
    }
    
    .password-toggle {
        right: 0.875rem;
    }
}

/* Loading Animation */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Checkbox */
.remember-me input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #dc3545;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.remember-me input[type="checkbox"]:checked {
    background: #dc3545;
}

.remember-me input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Campus and Office Selection */
.input-group select {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc3545' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
}

.input-group select:focus {
    outline: none;
    border-color: #dc3545;
    background: white;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.input-group select:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* Campus-specific styling */
.logo-circle i.fa-university {
    font-size: 2.5rem;
}

.logo-subtitle {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* Office selection enhancement */
.form-group select option {
    padding: 0.5rem;
}

/* Demo credentials update */
.demo-credentials .demo-account {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #dc3545;
    font-size: 0.85rem;
}

.demo-credentials .demo-account:last-child {
    margin-bottom: 0;
}
