/* Authentication Portals Enhanced Styling */
.auth-container {
    min-height: calc(100vh - 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    background: var(--cyber-dark);
    overflow: hidden;
}

/* Background Grid Effect */
.auth-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, rgba(30, 255, 0, 0.03) 1px, transparent 1px) 0 0,
        linear-gradient(rgba(30, 255, 0, 0.03) 1px, transparent 1px) 0 0;
    background-size: 20px 20px;
    pointer-events: none;
    animation: gridMove 20s linear infinite;
}

/* Portal Card */
.auth-card {
    background: var(--cyber-dark-alt);
    border: 2px solid var(--cyber-primary);
    padding: 2.5rem;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(30, 255, 0, 0.1);
    animation: portalAppear 0.5s ease-out;
}

/* Mobile responsiveness for auth cards */
@media (max-width: 600px) {
    .auth-card {
        padding: 1.5rem;
        margin: 1rem;
        max-width: 100%;
        border-width: 1px;
    }
    
    .auth-header {
        margin-bottom: 1.5rem;
    }
    
    .auth-header h2 {
        font-size: 1.8rem;
    }
}

/* Portal Header */
.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}

.auth-header h2 {
    color: var(--cyber-primary);
    font-family: var(--font-display);
    font-size: 2.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    text-shadow: var(--cyber-glow);
}

.auth-header p {
    color: var(--cyber-text-dim);
    font-family: var(--font-mono);
    font-size: 1.1rem;
}

/* Form Elements */
.auth-input {
    width: 100%;
    padding: 1rem;
    background: rgba(13, 36, 66, 0.9);
    border: 2px solid var(--cyber-primary);
    color: var(--cyber-text-bright) !important;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.auth-input:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(30, 255, 0, 0.3);
    background: rgba(13, 36, 66, 1);
}

.auth-input::placeholder {
    color: rgba(164, 230, 176, 0.7);
}

.auth-label {
    display: block;
    color: var(--cyber-primary);
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 0 8px rgba(30, 255, 0, 0.8), 0 0 15px rgba(30, 255, 0, 0.4);
    background: linear-gradient(90deg, var(--cyber-primary), #00ff41);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
}

.auth-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--cyber-primary), #00ff41);
    opacity: 0.1;
    border-radius: 4px;
    z-index: -1;
    padding: 0.2rem 0.5rem;
    margin: -0.2rem -0.5rem;
}

/* Enhanced visibility for specific labels */
.auth-label[for="nsi_id"],
.auth-label[for="username"] {
    font-size: 1.3rem;
    font-weight: 700;
    color: #00ff41 !important;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.9), 0 0 20px rgba(0, 255, 65, 0.5), 0 0 30px rgba(0, 255, 65, 0.3);
    background: none;
    -webkit-text-fill-color: #00ff41;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    background-image: linear-gradient(90deg, #00ff41, transparent);
    background-repeat: no-repeat;
    background-size: 0% 2px;
    background-position: bottom;
    transition: background-size 0.3s ease;
}

.auth-label[for="nsi_id"]:hover,
.auth-label[for="username"]:hover {
    background-size: 100% 2px;
}

.auth-label[for="password"] {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ff6b35 !important;
    text-shadow: 0 0 10px rgba(255, 107, 53, 0.9), 0 0 20px rgba(255, 107, 53, 0.5);
    background: none;
    -webkit-text-fill-color: #ff6b35;
    border-bottom: 2px solid transparent;
    background-image: linear-gradient(90deg, #ff6b35, transparent);
    background-repeat: no-repeat;
    background-size: 0% 2px;
    background-position: bottom;
    transition: background-size 0.3s ease;
}

.auth-label[for="password"]:hover {
    background-size: 100% 2px;
}

/* Mobile responsive auth labels */
@media (max-width: 768px) {
    .auth-label {
        font-size: 1.1rem;
        letter-spacing: 1.2px;
    }
    
    .auth-label[for="nsi_id"],
    .auth-label[for="username"],
    .auth-label[for="password"] {
        font-size: 1.2rem;
    }
}

/* Additional contrast enhancement */
@media (prefers-contrast: high) {
    .auth-label[for="nsi_id"],
    .auth-label[for="username"] {
        color: #00ff00 !important;
        text-shadow: 0 0 15px #00ff00, 0 0 25px #00ff00;
    }
    
    .auth-label[for="password"] {
        color: #ff4500 !important;
        text-shadow: 0 0 15px #ff4500, 0 0 25px #ff4500;
    }
}

/* Help Text */
.auth-help {
    color: var(--cyber-text-dim);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Submit Button */
.auth-button {
    width: 100%;
    padding: 1rem;
    background: var(--cyber-dark-alt);
    border: 2px solid var(--cyber-primary);
    color: var(--cyber-primary);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

.auth-button::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(30, 255, 0, 0.2), 
        transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.auth-button:hover {
    background: rgba(30, 255, 0, 0.1);
    box-shadow: 0 0 20px rgba(30, 255, 0, 0.3);
}

.auth-button:hover::before {
    transform: translateX(100%);
}

/* Password Input Wrapper with Toggle Button */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .auth-input {
    padding-right: 3rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0.7;
}

.password-toggle-btn:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.password-toggle-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.eye-icon {
    display: block;
    filter: grayscale(100%) brightness(1.5);
    transition: filter 0.3s ease;
}

.password-toggle-btn:hover .eye-icon {
    filter: grayscale(0%) brightness(1.2);
}

/* Footer Links */
.auth-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    text-align: center;
    border-top: 1px solid rgba(0, 191, 255, 0.2);
}

/* Footer links — readable cyan on the dark auth background (was only styled
   inside a mobile media query, leaving them dim/unreadable on desktop). */
.auth-footer p {
    margin: 0.5rem 0;
}

.auth-link {
    color: #4fc3f7;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.auth-link:hover {
    color: #8fe3ff;
    text-shadow: 0 0 8px rgba(79, 195, 247, 0.6);
    text-decoration: underline;
}

.footer-link-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.footer-text {
    color: var(--cyber-text-dim);
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.footer-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 191, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.footer-link:hover::before {
    left: 100%;
}

.footer-link-primary {
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.15) 0%, rgba(0, 229, 255, 0.1) 100%);
    border: 1px solid rgba(0, 191, 255, 0.3);
    color: var(--cyber-primary);
}

.footer-link-primary:hover {
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.25) 0%, rgba(0, 229, 255, 0.2) 100%);
    border-color: var(--cyber-primary);
    box-shadow: 0 0 15px rgba(0, 191, 255, 0.3);
    transform: translateY(-2px);
}

.footer-link-secondary {
    background: linear-gradient(135deg, rgba(100, 100, 100, 0.1) 0%, rgba(80, 80, 80, 0.05) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--cyber-text-dim);
}

.footer-link-secondary:hover {
    background: linear-gradient(135deg, rgba(120, 120, 120, 0.15) 0%, rgba(100, 100, 100, 0.1) 100%);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--cyber-text);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.link-icon {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.footer-link:hover .link-icon {
    transform: scale(1.2);
}

.link-text {
    font-weight: 500;
    letter-spacing: 0.5px;
}

.footer-divider {
    height: 1px;
    width: 60%;
    margin: 1rem auto;
    background: linear-gradient(90deg, transparent, rgba(0, 191, 255, 0.3), transparent);
}

/* Mobile responsive footer */
@media (max-width: 768px) {
    .footer-link-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-text {
        font-size: 0.9rem;
    }
    
    .footer-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}

/* Scanner Effect */
.auth-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent,
        var(--cyber-primary),
        transparent
    );
    animation: scan 2s linear infinite;
}

/* Animations */
@keyframes scan {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(1000%);
    }
}

@keyframes gridMove {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(20px);
    }
}

@keyframes portalAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Admin Portal Specific */
.admin-portal .auth-card {
    border-color: #ff3366;
}

.admin-portal .auth-button {
    border-color: #ff3366;
    color: #ff3366;
}

.admin-portal .auth-button:hover {
    background: rgba(255, 51, 102, 0.1);
    box-shadow: 0 0 20px rgba(255, 51, 102, 0.3);
}

.admin-portal .auth-header h2 {
    color: #ff3366;
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
}

/* Registration Portal Specific */
.register-portal .auth-card {
    border-image: linear-gradient(45deg, var(--cyber-primary), var(--cyber-accent)) 1;
}

.register-portal .auth-header h2 {
    background: linear-gradient(45deg, var(--cyber-primary), var(--cyber-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}