/* ===========================================
   TRAFFIC GMDP - MODERN LOGIN THEME
   Inspired by JunOS Design
   Fixed: Scrollable & Fully Responsive
   =========================================== */

/* ===== THEME VARIABLES ===== */
:root {
    /* Light Mode */
    --bg-gradient-primary: #f8fafc;
    --bg-gradient-secondary: #e2e8f0;
    --bg-gradient-tertiary: #cbd5e1;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(59, 130, 246, 0.3);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --btn-primary-color: #3b82f6;
    --btn-success-color: #10b981;
    --input-border: #d1d5db;
    --input-bg: #ffffff;
    --shadow-light: rgba(0, 0, 0, 0.08);
}

.dark-theme {
    /* Dark Mode */
    --bg-gradient-primary: #0f172a;
    --bg-gradient-secondary: #1e293b;
    --bg-gradient-tertiary: #334155;
    --card-bg: rgba(15, 23, 42, 0.75);
    --card-border: rgba(147, 197, 253, 0.25);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --btn-primary-color: #93c5fd;
    --btn-success-color: #34d399;
    --input-border: #334155;
    --input-bg: #1e293b;
    --shadow-light: rgba(0, 0, 0, 0.4);
}

/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

body {
    font-family: 'Segoe UI', 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-primary), var(--bg-gradient-secondary), var(--bg-gradient-tertiary));
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    transition: background 0.3s ease;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: rotate(360deg);
}

.theme-toggle i {
    color: var(--text-primary);
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

/* ===== MAIN WRAPPER - Allows Scrolling ===== */
.main-wrapper {
    flex: 1;
    width: 100%;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px); /* Adjust for footer height */
}

/* ===== LOGIN CARD ===== */
.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--shadow-light);
    padding: 50px 60px;
    width: 100%;
    max-width: 480px;
    border: 1px solid var(--card-border);
    animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 20px auto;
}

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

/* ===== LOGO SECTION ===== */
.logo-section {
    animation: fadeIn 0.8s ease;
    text-align: center;
}

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

.cacti-logo {
    width: 100%;
    height: 80px;
    background: url('../images/cacti_logo.png') no-repeat center center;
    background-size: contain;
    margin-bottom: 20px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.login-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== LOGIN FORM ===== */
.login-form {
    width: 100%;
    margin-top: 30px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-label i {
    color: var(--btn-primary-color);
    font-size: 16px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-control:focus {
    outline: none;
    border-color: var(--btn-primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--input-bg);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Error Alert */
.alert {
    background: rgba(254, 202, 202, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 8px;
    padding: 14px 16px;
    color: #dc2626;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.dark-theme .alert {
    background: rgba(127, 29, 29, 0.2);
    border-color: rgba(220, 38, 38, 0.4);
}

.alert i {
    color: #dc2626;
    font-size: 18px;
}

/* ===== LOGIN BUTTON ===== */
.btn-login {
    background: linear-gradient(135deg, var(--btn-success-color), #059669);
    color: #0d3b1e;
    font-weight: 700;
    padding: 14px;
    border-radius: 50px;
    border: none;
    font-size: 16px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
}

.dark-theme .btn-login {
    color: #0a2a17;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* ===== COMPANY INFO ===== */
.company-info {
    color: var(--text-secondary);
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--card-border);
}

.company-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--btn-primary-color);
    margin: 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.company-details {
    font-size: 13px;
    line-height: 1.8;
    margin-top: 15px;
}

.company-details p {
    margin: 8px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.company-details i {
    color: var(--btn-primary-color);
    font-size: 14px;
    min-width: 20px;
    margin-top: 3px;
}

.company-details strong {
    color: var(--text-primary);
    font-weight: 600;
    min-width: 80px;
    display: inline-block;
}

/* ===== FOOTER ===== */
.main-footer {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--card-border);
    padding: 20px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== BOOTSTRAP OVERRIDES ===== */
.form-check-label {
    color: var(--text-primary);
    font-weight: 500;
}

.form-check-input:checked {
    background-color: var(--btn-primary-color);
    border-color: var(--btn-primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .main-wrapper {
        padding: 30px 15px;
        min-height: calc(100vh - 60px);
    }
    
    .login-card {
        padding: 40px 35px;
        margin: 15px auto;
    }
    
    .login-title {
        font-size: 24px;
    }
    
    .login-subtitle {
        font-size: 14px;
    }
    
    .company-info {
        margin-top: 30px;
        padding-top: 25px;
    }
}

@media (max-width: 480px) {
    .main-wrapper {
        padding: 20px 10px;
        min-height: calc(100vh - 50px);
    }
    
    .login-card {
        padding: 35px 25px;
        border-radius: 16px;
        margin: 10px auto;
    }
    
    .logo-section {
        margin-bottom: 25px;
    }
    
    .cacti-logo {
        height: 60px;
    }
    
    .login-title {
        font-size: 22px;
    }
    
    .login-subtitle {
        font-size: 13px;
    }
    
    .form-control {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .btn-login {
        padding: 12px;
        font-size: 15px;
    }
    
    .company-name {
        font-size: 16px;
    }
    
    .company-details {
        font-size: 12px;
    }
    
    .company-details p {
        margin: 6px 0;
    }
    
    .main-footer {
        padding: 15px 0;
        font-size: 12px;
    }
}

/* ===== ADDITIONAL FIXES ===== */
/* Ensure content is not cut off */
.login-card {
    overflow: visible;
}

/* Prevent body from being cut off */
body {
    overflow-x: hidden;
    overflow-y: auto;
}

/* Ensure footer stays at bottom but allows scrolling */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper {
    flex: 1 0 auto;
}

.main-footer {
    flex-shrink: 0;
}

/* Fix for mobile devices */
@media (max-height: 700px) {
    .main-wrapper {
        padding: 20px 10px;
    }
    
    .login-card {
        padding: 30px 20px;
        margin: 10px;
    }
    
    .company-info {
        margin-top: 20px;
        padding-top: 20px;
    }
}
