/* Root Variables */
:root {
    --primary-blue: #4169E1;
    --primary-dark: #2F4F8F;
    --background-light: #f8f9fa;
    --text-dark: #344767;
    --border-color: #d2d6da;
    --error-color: #dc3545;
    --success-color: #28a745;
    --white: #ffffff;
    --shadow: 0 0 20px rgba(0,0,0,0.1);
    --shadow-dark: 0 8px 32px rgba(0,0,0,0.3);
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--background-light);
    min-height: 100vh;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

/* Desktop Layout */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    background-color: #f0f2f5;
}

/* Ensure Vanta canvas is behind content */
.auth-container canvas {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 0;
}

.auth-wrapper {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-dark);
    width: 100%;
    max-width: 900px;
    min-height: 600px;
    display: flex;
    position: relative;
    z-index: 1;
}

.auth-left {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    position: relative;
    overflow: hidden;
}

.auth-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="flames" patternUnits="userSpaceOnUse" width="100" height="100"><path d="M20,80 Q30,60 40,80 T60,80 Q70,60 80,80" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="2"/></pattern></defs><rect width="100" height="100" fill="url(%23flames)"/></svg>') repeat;
    opacity: 0.3;
}

.auth-left-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--white);
}

.auth-logo {
    width: 120px;
    height: 120px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    padding: 1rem;
}

.auth-logo img {
    max-width: 85%;
    max-height: 85%;
    height: auto;
    object-fit: contain;
}

.auth-logo .flame-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    border-radius: 20% 20% 50% 50%;
}

.auth-brand {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

.auth-brand-logo {
    margin-bottom: 1.5rem;
    max-width: 220px;
    margin-left: auto;
    margin-right: auto;
}

.auth-brand-logo img {
    width: 100%;
    height: auto;
    filter: brightness(0) invert(1); /* Make logo white for dark background */
}

.auth-tagline {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.6;
    max-width: 280px;
    margin: 0 auto;
}

.auth-right {
    flex: 1;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: #ffffff;
    background-image: url("https://www.transparenttextures.com/patterns/xv.png");
}

.card {
    border: none;
    background: transparent;
    box-shadow: none;
}

.card-body {
    padding: 0;
}

/* Mobile Welcome Screen */
.mobile-welcome {
    display: none;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    height: 100vh;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.mobile-welcome::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="flames-mobile" patternUnits="userSpaceOnUse" width="100" height="100"><path d="M20,80 Q30,60 40,80 T60,80 Q70,60 80,80" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23flames-mobile)"/></svg>') repeat;
}

.mobile-welcome-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 2rem;
    text-align: center;
    color: var(--white);
}

.mobile-logo {
    width: 115px;
    height: 115px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    padding: 10px;
}

.mobile-logo img {
    max-width: 90%;
    max-height: 90%;
    height: auto;
    object-fit: contain;
}

.mobile-logo .flame-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    border-radius: 20% 20% 50% 50%;
}

.mobile-brand {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.mobile-brand-logo {
    margin-bottom: 1rem;
    max-width: 200px;
}

.mobile-brand-logo img {
    width: 100%;
    height: auto;
    filter: brightness(0) invert(1); /* Make logo white */
}

.mobile-tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 4rem;
    line-height: 1.6;
}

.mobile-buttons {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.btn-mobile {
    padding: 8px 2rem;
    border-radius: 5px;
    font-weight: 600;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-mobile-primary {
    background: var(--white);
    color: var(--primary-blue);
}

.btn-mobile-secondary {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-mobile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* Mobile Login Screen */
.mobile-login {
    display: none;
    background-color: #ffffff;
    background-image: url("https://www.transparenttextures.com/patterns/xv.png");
    min-height: 100vh;
    height: 100vh;
    width: 100%;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
}

.mobile-login.active {
    transform: translateX(0);
}

.mobile-login-content {
    min-height: 100vh;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.mobile-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    padding: 3rem 2rem 2rem;
    /* border-radius: 0 0 2rem 2rem; */
    position: relative;
    box-shadow: 0 4px 20px rgba(65, 105, 225, 0.2);
}

.mobile-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.mobile-logo-small {
    width: 75px;
    height: 75px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    padding: 0.65rem;
}

.mobile-logo-small img {
    max-width: 85%;
    max-height: 85%;
    height: auto;
    object-fit: contain;
}

.mobile-logo-small .flame-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    border-radius: 20% 20% 50% 50%;
}

.mobile-brand-small {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white);
    margin: 0;
    letter-spacing: 0.5px;
}

.mobile-brand-logo-small {
    max-width: 140px;
    margin: 0 auto;
}

.mobile-brand-logo-small img {
    width: 100%;
    height: auto;
    filter: brightness(0) invert(1); /* Make logo white */
}

.back-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mobile-form-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 2rem 1rem;
    background-color: #ffffff;
    background-image: url("https://www.transparenttextures.com/patterns/xv.png");
}

.mobile-form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.mobile-form-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.mobile-form-subtitle {
    color: #6c757d;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-label {
    display: none; /* Hide labels for cleaner mobile design */
}

.form-control {
    height: 50px;
    padding: 0.875rem 1rem 0.875rem 3rem;
    font-size: 0.9375rem;
    border: 2px solid #e9ecef;
    border-radius: 12px !important;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--text-dark);
    width: 100%;
    box-sizing: border-box;
}

.form-control::placeholder {
    color: #9ca3af;
    font-size: 0.875rem;
}

.form-control:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(65, 105, 225, 0.1);
    background: var(--white);
    outline: none;
    border-radius: 12px !important;
}

/* Input Group Styles */
.input-group {
    position: relative;
    display: block;
    width: 100%;
}

.input-group .form-control {
    padding-left: 3rem;
    padding-right: 3rem;
    width: 100%;
    border-radius: 12px !important;
}

.input-group-text {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    color: #9ca3af;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 1.25rem;
}

.input-group .form-control:focus ~ .input-group-text,
.input-group .form-control:not(:placeholder-shown) ~ .input-group-text {
    color: var(--primary-blue);
}

/* Invalid State Styling */
.form-control.is-invalid {
    border-color: var(--error-color);
    background: #fff5f5;
    border-radius: 12px !important;
}

.input-group.is-invalid .form-control {
    border-color: var(--error-color);
    border-radius: 12px !important;
}

.input-group.is-invalid .input-group-text {
    color: var(--error-color);
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875em;
    color: var(--error-color);
}

.form-control.is-invalid ~ .invalid-feedback,
.input-group.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Password Toggle Button */
#togglePassword,
#mobileTogglePassword {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

#togglePassword:hover,
#mobileTogglePassword:hover {
    color: var(--primary-blue);
}

#togglePassword:focus,
#mobileTogglePassword:focus {
    outline: none;
    box-shadow: none;
}

.input-group.is-invalid #togglePassword,
.input-group.is-invalid #mobileTogglePassword {
    color: var(--error-color);
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
    border: none;
    padding: 0.875rem 2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    height: 50px;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(65, 105, 225, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Trouble Link */
.trouble-link {
    display: block;
    text-align: right;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6c757d;
    text-decoration: none;
    transition: color 0.3s ease;
}

.trouble-link:hover {
    color: var(--primary-blue);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
        margin: 0;
        overflow-x: hidden;
    }
    
    .auth-container {
        display: none !important;
    }
    
    .auth-wrapper {
        display: none !important;
    }
    
    .mobile-welcome {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 1000;
    }
    
    .mobile-login {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 1001;
    }
    
    /* Hide labels on mobile for cleaner look */
    .mobile-login .form-label {
        display: none;
    }
    
    /* Adjust input group for mobile */
    .mobile-login .input-group .form-control {
        padding-left: 3rem;
        padding-right: 3rem;
        border-radius: 12px !important;
    }
    
    /* Ensure border-radius on mobile */
    .mobile-login .form-control {
        border-radius: 12px !important;
    }
}

@media (min-width: 769px) {
    .mobile-welcome,
    .mobile-login {
        display: none !important;
    }
    
    .auth-container {
        display: flex !important;
    }
    
    .auth-wrapper {
        display: flex;
    }
    
    /* Show labels on desktop */
    .form-label {
        display: block;
        font-weight: 500;
        margin-bottom: 0.5rem;
        color: var(--text-dark);
        font-size: 0.9rem;
    }
    
    /* Desktop input adjustments */
    .auth-right .input-group .form-control {
        padding-left: 3rem;
        padding-right: 3rem;
        border-radius: 12px !important;
    }
    
    /* Ensure border-radius on desktop */
    .auth-right .form-control {
        border-radius: 12px !important;
    }
}

/* Bootstrap Override - Force border-radius */
.form-control,
.input-group .form-control,
.input-group>.form-control,
input.form-control {
    border-radius: 12px !important;
}

/* Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading:after {
    content: '';
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--white);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -0.5rem;
    margin-left: -0.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Animation */
.shake {
    animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Focus States */
.form-control:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(65, 105, 225, 0.1);
}

.form-control.is-invalid:focus {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Bootstrap Overrides */
.input-group>.form-control:focus, 
.input-group>.form-floating:focus-within, 
.input-group>.form-select:focus {
    z-index: 0 !important;
}

.input-group>.form-control:not(:focus).is-invalid, 
.input-group>.form-floating:not(:focus-within).is-invalid, 
.input-group>.form-select:not(:focus).is-invalid, 
.was-validated .input-group>.form-control:not(:focus):invalid, 
.was-validated .input-group>.form-floating:not(:focus-within):invalid, 
.was-validated .input-group>.form-select:not(:focus):invalid {
    z-index: 0 !important;
}

/* Developer Credit */
.developer-credit {
    text-align: center;
    margin-top: 2rem;
    color: #6c757d;
    font-size: 0.85rem;
}

/* Desktop Form Header */
.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Welcome Message */
.welcome-message {
    margin-bottom: 1rem;
}

.welcome-user {
    color: var(--primary-blue);
    font-weight: 600;
}

/* Slide Animations */
.slide-container {
    position: relative;
    overflow: hidden;
    height: 100vh;
}

.slide-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide-screen.slide-left {
    transform: translateX(-100%);
}

.slide-screen.slide-right {
    transform: translateX(100%);
}

.slide-screen.active {
    transform: translateX(0);
}