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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto; /* allow scroll on small screens */
    position: relative;
}

/* Login Lottie overlay */
#loginLoadingOverlay {
    display: none;
}
#loginLoadingOverlay.show {
    display: flex !important;
}

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

.floating-shapes {
    position: relative;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(65, 255, 255, 0.08);
    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: 1s;
}

.shape-3 {
    width: 60px;
    height: 60px;
    bottom: 20%;
    left: 20%;
    animation-delay: 2s;
}

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

.shape-5 {
    width: 40px;
    height: 40px;
    bottom: 40%;
    right: 10%;
    animation-delay: 4s;
}

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

/* Container */
.container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

/* Login Card */
.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(65, 255, 255, 0.1);
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dark mode for login page */
:root.dark body { background: #0b1416; }
:root.dark .login-card { background: rgba(20,26,28,0.9); border-color: rgba(255,255,255,0.08); box-shadow: 0 25px 50px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.04); }
:root.dark .tagline { color: #9cb2b2; }
:root.dark input[type="text"],
:root.dark input[type="password"] { color: #e6f0f0; background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
:root.dark input[type="text"]:focus,
:root.dark input[type="password"]:focus { background: rgba(255,255,255,0.08); box-shadow: 0 0 0 4px rgba(65,255,255,0.10); }
:root.dark .input-icon { color: #9cb2b2; }
:root.dark .toggle-password:hover { background: rgba(255,255,255,0.06); }
:root.dark .checkbox-container { color: #9cb2b2; }
:root.dark .checkmark { border-color: rgba(255,255,255,0.2); }
:root.dark .security-note { color: #9cb2b2; }
:root.dark .success-animation { background: rgba(0,0,0,0.6); }

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 35px 70px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.4);
}

/* Card Header */
.card-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: transparent;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
}

.elama-logo-img {
    width: 160px;
    height: 160px;
    object-fit: contain;
}

.brand-name {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #41ffff 0%, #2ee6e6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.tagline {
    color: #6b7280;
    font-size: 16px;
    font-weight: 400;
    margin: 0;
}

/* Form */
.login-form {
    margin-bottom: 32px;
}

.input-group {
    margin-bottom: 24px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: #9ca3af;
    font-size: 18px;
    z-index: 2;
    transition: color 0.3s ease;
}

.input-wrapper:focus-within .input-icon {
    color: #41ffff;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    height: 56px;
    padding: 0 20px 0 48px;
    border: 2px solid rgba(65, 255, 255, 0.2);
    border-radius: 16px;
    font-size: 16px;
    font-weight: 500;
    color: #1f2937;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: #41ffff;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 4px rgba(65, 255, 255, 0.15);
}

input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.input-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, #41ffff 0%, #2ee6e6 100%);
    transition: width 0.3s ease;
}

.input-wrapper:focus-within .input-border {
    width: 100%;
}

.toggle-password {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.toggle-password:hover {
    color: #41ffff;
    background: rgba(65, 255, 255, 0.1);
}

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

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.checkbox-container input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    margin-right: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, #41ffff 0%, #2ee6e6 100%);
    border-color: #41ffff;
}

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

.forgot-password {
    color: #41ffff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #2ee6e6;
}

/* Login Button */
.login-btn {
    width: 100%;
    height: 56px;
    background: linear-gradient(135deg, #41ffff 0%, #2ee6e6 100%);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(65, 255, 255, 0.3);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(65, 255, 255, 0.4);
}

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

.login-btn.loading {
    pointer-events: none;
}

.btn-text {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-btn.loading .btn-text {
    opacity: 0;
}

.login-btn.loading .btn-loader {
    opacity: 1;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Card Footer */
.card-footer {
    text-align: center;
}

.security-note {
    color: #9ca3af;
    font-size: 14px;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.security-note i {
    color: #10b981;
}

/* Success Animation */
.success-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(25px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.success-animation.show {
    opacity: 1;
    visibility: visible;
}

.success-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #10b981;
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px #10b981;
    animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
    position: relative;
    top: 5px;
    margin: 0 auto;
}

.check-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #10b981;
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px #10b981;
    animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
    position: relative;
    top: 5px;
    margin: 0 auto;
}

.check-icon .icon-line {
    stroke: #10b981;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: line .4s ease-in-out .8s forwards;
}

.check-icon .icon-line.line-tip {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: line .4s ease-in-out .8s forwards;
}

.check-icon .icon-line.line-long {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: line .4s ease-in-out .8s forwards;
}

.check-icon .icon-circle {
    stroke: #10b981;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: fill .4s ease-in-out .4s forwards;
}

.check-icon .icon-fix {
    stroke: #10b981;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: fill .4s ease-in-out .4s forwards;
}

@keyframes fill {
    100% {
        box-shadow: inset 0px 0px 0px 30px #10b981;
    }
}

@keyframes scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes line {
    100% {
        stroke-dashoffset: 0;
    }
}

/* --- Strong dark-mode overrides to ensure inputs render correctly --- */
:root.dark input[type="text"],
:root.dark input[type="password"] {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #e6f0f0 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

:root.dark input[type="text"]:focus,
:root.dark input[type="password"]:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 0 0 4px rgba(65, 255, 255, 0.10) !important;
}

:root.dark input::placeholder {
    color: #9cb2b2 !important;
}

:root.dark .input-icon {
    color: #9cb2b2 !important;
}

:root.dark .toggle-password:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    .login-card {
        padding: 24px 18px;
        border-radius: 20px;
    }
    
    .elama-logo-img { width: 140px; height: 140px; }
    .form-options { flex-direction: column; gap: 12px; align-items: flex-start; }
    .login-btn { height: 52px; }
}

/* Loading States */
.input-wrapper.loading {
    pointer-events: none;
}

.input-wrapper.loading input {
    background: rgba(249, 250, 251, 0.8);
    color: #9ca3af;
}

/* Error States */
.input-wrapper.error input {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.input-wrapper.error .input-icon {
    color: #ef4444;
}

.error-message {
    color: #ef4444;
    font-size: 14px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message i {
    font-size: 16px;
}
