* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #b39d72;
    --secondary-color: #d4af37;
    --accent-color: #f4e5c2;
    --dark-bg: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --input-bg: rgba(255, 255, 255, 0.9);
    --border-color: rgba(179, 157, 114, 0.3);
    --gold: #b39d72;
    --gold-light: #d4af37;
    --gold-dark: #8b7355;
    --primary-gold: #b39d72;
    --hover-bg: rgba(255, 255, 255, 0.7);
}

body {
    font-family: 'Segoe UI', 'Rubik', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(179, 157, 114, 0.1);
}

::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-light);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gold) rgba(179, 157, 114, 0.1);
}

/* Animated Background */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 50%, #f5f5f5 100%);
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(179, 157, 114, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(179, 157, 114, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particles::before,
.particles::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(100px);
    animation: float 15s ease-in-out infinite;
}

.particles::before {
    background: radial-gradient(circle, rgba(179, 157, 114, 0.15) 0%, transparent 70%);
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.particles::after {
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, transparent 70%);
    bottom: 20%;
    right: 10%;
    animation-delay: 7s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -50px) scale(1.1); }
    66% { transform: translate(-50px, 50px) scale(0.9); }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

/* Login Card */
.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 480px;
    box-shadow:
        0 20px 60px rgba(179, 157, 114, 0.15),
        0 0 40px rgba(179, 157, 114, 0.1),
        inset 0 1px 1px rgba(179, 157, 114, 0.1);
    animation: cardEntry 0.6s ease-out;
    position: relative;
}

/* Language Toggle */
.language-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

[dir="rtl"] .language-toggle {
    right: auto;
    left: 1rem;
}

.lang-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.lang-btn:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(179, 157, 114, 0.3);
}

.lang-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Reset Password Form */
.reset-password-form {
    animation: cardEntry 0.6s ease-out;
}

.reset-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-align: center;
}

.reset-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 2rem;
}

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

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

.ai-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ai-circle {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 2;
    opacity: 0.3;
}

.ai-diamond {
    fill: none;
    stroke: var(--secondary-color);
    stroke-width: 2;
    animation: pulse 2s ease-in-out infinite;
}

.ai-core {
    fill: var(--primary-color);
    filter: drop-shadow(0 0 10px var(--primary-color));
    animation: glow 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes glow {
    0%, 100% { filter: drop-shadow(0 0 5px var(--primary-color)); }
    50% { filter: drop-shadow(0 0 20px var(--primary-color)); }
}

.brand-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-light) 50%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

/* Form */
.login-form {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(179, 157, 114, 0.2);
    background: rgba(255, 255, 255, 0.95);
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    pointer-events: none;
}

.input-wrapper input:focus + .input-icon {
    color: var(--primary-color);
}

/* Button */
.login-btn {
    position: relative;
    width: 100%;
    padding: 1.2rem;
    background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-light) 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2rem;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(179, 157, 114, 0.5);
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 50%, var(--gold-light) 100%);
}

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

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.login-btn:hover .btn-glow {
    left: 100%;
}

/* Form Footer */
.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.link {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.link:hover {
    color: var(--gold-light);
    text-decoration: underline;
}

.divider {
    margin: 0 0.75rem;
    opacity: 0.3;
}

/* Features */
.features {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(179, 157, 114, 0.2);
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    text-align: center;
}

.feature-icon {
    font-size: 1.5rem;
    animation: bounce 2s ease-in-out infinite;
}

.feature-item:nth-child(2) .feature-icon {
    animation-delay: 0.2s;
}

.feature-item:nth-child(3) .feature-icon {
    animation-delay: 0.4s;
}

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

.feature-item span {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Shake Animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* RTL Support - Login and General */
[dir="rtl"] body {
    font-family: 'Rubik', 'Segoe UI', Arial, sans-serif;
}

[dir="rtl"] .input-wrapper input {
    padding: 1rem 3rem 1rem 1rem;
}

[dir="rtl"] .input-icon {
    left: auto;
    right: 1rem;
}

/* Izy AI Assistant */
.izy-assistant {
    position: fixed;
    bottom: 30px;
    z-index: 1100;
    transition: all 0.3s ease;
    background: transparent !important;
}

[dir="ltr"] .izy-assistant {
    right: 30px;
    left: auto;
}

[dir="rtl"] .izy-assistant {
    right: 30px;
    left: auto;
}

/* Adjust position when sidebar is pinned - ensure it stays in main content area */
[dir="rtl"] body.sidebar-pinned .izy-assistant {
    right: 30px;
    left: auto;
}

[dir="ltr"] body.sidebar-pinned .izy-assistant {
    right: 30px;
    left: auto;
}

.izy-character {
    width: 120px;
    height: 180px;
    animation: izyFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 8px 20px rgba(179, 157, 114, 0.4));
    cursor: pointer;
    background: transparent !important;
}

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

.izy-character svg {
    width: 100%;
    height: 100%;
    background: transparent !important;
}

.izy-character .sparkle {
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(2);
    }
}

.izy-bubble {
    position: absolute;
    bottom: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 3px solid var(--gold);
    border-radius: 20px;
    padding: 16px 20px;
    margin-bottom: 15px;
    width: 220px;
    box-shadow: 0 8px 30px rgba(179, 157, 114, 0.3);
    transition: all 0.3s ease;
    pointer-events: auto;
    z-index: 10;
}

[dir="ltr"] .izy-bubble {
    right: 0;
    left: auto;
}

[dir="rtl"] .izy-bubble {
    right: 0;
    left: auto;
}

.izy-bubble.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.izy-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid var(--gold);
}

[dir="ltr"] .izy-bubble::after {
    right: 30px;
}

[dir="rtl"] .izy-bubble::after {
    right: 30px;
}

.izy-tip {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    transition: opacity 0.3s ease;
}

/* Responsive */
@media (max-width: 640px) {
    .login-card {
        padding: 2rem;
    }

    .brand-title {
        font-size: 2rem;
    }

    .features {
        flex-direction: column;
        gap: 1.5rem;
    }

    .feature-item {
        flex-direction: row;
        justify-content: center;
    }

    [dir="rtl"] .language-toggle,
    [dir="rtl"] .language-toggle-dashboard {
        left: 0.5rem;
        right: auto;
    }

    [dir="ltr"] .language-toggle,
    [dir="ltr"] .language-toggle-dashboard {
        right: 0.5rem;
        left: auto;
    }

    .izy-assistant {
        bottom: 15px;
    }

    [dir="ltr"] .izy-assistant {
        right: 15px;
    }

    [dir="rtl"] .izy-assistant {
        right: 15px;
        left: auto;
    }

    [dir="rtl"] body.sidebar-pinned .izy-assistant {
        right: 15px;
        left: auto;
    }

    .izy-character {
        width: 90px;
        height: 135px;
    }

    .izy-bubble {
        width: 280px;
        padding: 14px 16px;
    }

    .izy-tip {
        font-size: 0.85rem;
    }
}
