/* ============================================================
   Theme Index4: "Emerald Professional" — Split Layout
   Bootstrap 5 + CSS Animations
   ============================================================ */

:root {
    --idx4-primary: #059669;
    --idx4-primary-rgb: 5, 150, 105;
    --idx4-primary-light: #047857;
    --idx4-primary-dark: #047857;
    --idx4-accent: #0d9488;
    --idx4-accent-rgb: 13, 148, 136;
    --idx4-secondary: #f59e0b;
    --idx4-secondary-rgb: 245, 158, 11;
    --idx4-success: #10b981;
    --idx4-text: #0f172a;
    --idx4-text-muted: #64748b;
    --idx4-text-light: #94a3b8;
    --idx4-border: #e2e8f0;
    --idx4-input-bg: #f8fafc;
    --idx4-input-border: #cbd5e1;
    --idx4-radius: 1.25rem;
    --idx4-radius-sm: 0.75rem;

    /* Shared component aliases */
    --aff-primary: var(--idx4-primary);
    --aff-primary-rgb: var(--idx4-primary-rgb);
    --aff-primary-dark: var(--idx4-primary-dark);
    --aff-primary-light: var(--idx4-primary-dark);
    --aff-text: var(--idx4-text);
    --aff-text-muted: var(--idx4-text-muted);
    --aff-radius: var(--idx4-radius-sm);
    --aff-input-bg: var(--idx4-input-bg);
    --aff-input-border: var(--idx4-input-border);
}

html, body { height: 100%; margin: 0; padding: 0; overflow-x: hidden; }

body {
    background: dark;
    color: var(--idx4-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Split Layout --- */
.idx4-split { display: flex; min-height: 100vh; width: 100%; }

.idx4-form-pane {
    flex: 1 1 48%;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    position: relative;
    z-index: 2;
    min-height: 100vh;
}

.idx4-image-pane {
    flex: 1 1 52%;
    display: none;
    position: relative;
    overflow: hidden;
    /*background-image: url(../img/bg-06.png);*/
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Gradient overlay on image */
.idx4-image-pane::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(5,150,105,0.15) 0%, rgba(13,148,136,0.1) 50%, rgba(0,0,0,0.05) 100%);
    z-index: 1;
}

/* Decorative elements */
.idx4-image-pane .idx4-deco {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    z-index: 2;
}

.idx4-image-pane .idx4-deco-1 {
    width: 200px; height: 200px;
    background: linear-gradient(135deg, rgba(var(--idx4-primary-rgb),0.5), rgba(var(--idx4-accent-rgb),0.3));
    top: 8%; right: -40px;
    animation: idx4Drift1 18s ease-in-out infinite alternate;
}

.idx4-image-pane .idx4-deco-2 {
    width: 150px; height: 150px;
    background: linear-gradient(135deg, rgba(var(--idx4-secondary-rgb),0.4), rgba(var(--idx4-primary-rgb),0.2));
    bottom: 15%; left: -25px;
    animation: idx4Drift2 22s ease-in-out infinite alternate;
}

@keyframes idx4Drift1 { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(-20px,30px) scale(1.1); } }
@keyframes idx4Drift2 { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(25px,-20px) scale(1.15); } }

/* Art pane brand */
.idx4-art-brand {
    position: absolute;
    bottom: 2rem; left: 0; right: 0;
    text-align: center;
    z-index: 3;
}

.idx4-art-brand h5 { color: #fff; font-weight: 800; font-size: 1.1rem; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.idx4-art-brand p { color: rgba(255,255,255,0.8); font-size: 0.85rem; text-shadow: 0 1px 4px rgba(0,0,0,0.2); }

@media (min-width: 992px) { .idx4-image-pane { display: block; } }

/* --- Top Bar --- */
.idx4-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    flex-shrink: 0;
}

.idx4-topbar .navbar-brand img {
    max-width: 180px; max-height: 45px; height: auto;
    object-fit: contain; transition: transform 0.3s ease;
}
.idx4-topbar .navbar-brand img:hover { transform: scale(1.04); }
.idx4-topbar .navbar-brand img.customLogoClass { max-width: none; max-height: none; }

/* Language */
.language-changer { position: relative; color: var(--idx4-text); }
.language-changer > a {
    background: #f0fdf4; color: var(--idx4-text);
    border: 1px solid var(--idx4-border);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    padding: 0.45rem 1rem; border-radius: 50px;
    font-size: 0.875rem; transition: all 0.3s ease;
}
.language-changer > a:hover, .language-changer > a:focus {
    background: linear-gradient(135deg, var(--idx4-primary), var(--idx4-primary-dark));
    color: #fff; border-color: transparent;
    box-shadow: 0 4px 15px rgba(var(--idx4-primary-rgb),0.3);
}
.selected-language { width: 24px; margin-right: 8px; }
.country-wrap .dropdown-item img { width: 20px; margin-right: 8px; }
.dropdown-menu.country-wrap, .country-wrap.dropdown-menu {
    border: 1px solid var(--idx4-border); border-radius: var(--idx4-radius-sm);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); padding: 0.5rem 0;
}
.country-wrap .dropdown-item { padding: 0.5rem 1rem; font-size: 0.9rem; transition: background 0.2s ease; }
.country-wrap .dropdown-item:hover { background: rgba(var(--idx4-primary-rgb),0.06); }

/* --- Form Content --- */
.idx4-form-content {
    flex: 1; display: flex; align-items: flex-start;
    justify-content: center; padding: 1.5rem 2rem 2rem; overflow-y: auto;
}
.idx4-form-wrapper { width: 100%; max-width: 440px; margin: auto 0; }

/* --- Header Icon --- */
.idx4-header-icon {
    width: 58px; height: 58px; border-radius: 0.875rem;
    background: linear-gradient(135deg, var(--idx4-primary), var(--idx4-accent));
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
    box-shadow: 0 6px 20px rgba(var(--idx4-primary-rgb),0.25);
    animation: idx4IconPulse 3s ease-in-out infinite;
}
.idx4-header-icon i { font-size: 1.5rem; color: #fff; }

@keyframes idx4IconPulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(var(--idx4-primary-rgb),0.25); }
    50% { box-shadow: 0 6px 28px rgba(var(--idx4-primary-rgb),0.4); }
}

.idx4-title { font-size: 1.6rem; font-weight: 800; color: var(--idx4-text); margin-bottom: 0.25rem; letter-spacing: -0.02em; }
.idx4-subtitle { color: var(--idx4-text-muted); font-size: 0.92rem; }

/* --- Nav Pills --- */
.idx4-nav-pills {
    background: #f0fdf4; border-radius: var(--idx4-radius-sm);
    padding: 0.25rem; border: 1px solid #d1fae5;
}
.idx4-nav-pills .nav-link {
    color: var(--idx4-text-muted); font-weight: 600; font-size: 0.875rem;
    border-radius: 0.6rem; padding: 0.6rem 1rem;
    transition: all 0.3s ease; text-align: center; border: none;
}
.idx4-nav-pills .nav-link:hover { color: var(--idx4-primary); background: rgba(var(--idx4-primary-rgb),0.06); }
.idx4-nav-pills .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--idx4-primary), var(--idx4-primary-dark));
    box-shadow: 0 4px 12px rgba(var(--idx4-primary-rgb),0.3);
}

/* --- Inputs --- */
.idx4-input-group { position: relative; }
.idx4-input {
    background: var(--idx4-input-bg) !important;
    border: 1.5px solid var(--idx4-input-border) !important;
    border-radius: var(--idx4-radius-sm) !important;
    color: var(--idx4-text) !important;
    height: 56px; font-size: 0.95rem;
    transition: all 0.3s ease; padding-right: 3rem;
}
.idx4-input::placeholder { color: transparent; }
.idx4-input:focus {
    background: #fff !important;
    border-color: var(--idx4-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--idx4-primary-rgb),0.1), 0 4px 16px rgba(var(--idx4-primary-rgb),0.06) !important;
}
.idx4-input-group label { color: var(--idx4-text-muted); font-size: 0.9rem; }
.idx4-input-group .form-control:focus ~ label,
.idx4-input-group .form-control:not(:placeholder-shown) ~ label { color: var(--idx4-primary); }

.idx4-input-group .toggle-password {
    position: absolute; top: 50%; right: 12px; transform: translateY(-50%); z-index: 5;
    color: var(--idx4-text-light); background: transparent; border: none;
    padding: 0.25rem 0.5rem; cursor: pointer; transition: all 0.3s ease; border-radius: 50%;
}
.idx4-input-group .toggle-password:hover { color: var(--idx4-primary); background: rgba(var(--idx4-primary-rgb),0.08); }

/* --- Info Banner --- */
.idx4-info-banner {
    background: linear-gradient(135deg, rgba(var(--idx4-primary-rgb),0.05), rgba(var(--idx4-accent-rgb),0.03));
    border: 1px solid rgba(var(--idx4-primary-rgb),0.1);
    border-left: 3px solid var(--idx4-primary);
    border-radius: var(--idx4-radius-sm); padding: 1rem 1.15rem;
}
.idx4-info-banner i { color: var(--idx4-primary); }
.idx4-info-banner h6 { color: var(--idx4-text); font-size: 0.88rem; font-weight: 700; }
.idx4-info-banner p { color: var(--idx4-text-muted); font-size: 0.82rem; line-height: 1.5; }

/* --- Buttons --- */
.idx4-btn-primary {
    background: linear-gradient(135deg, var(--idx4-primary), var(--idx4-primary-dark));
    background-size: 200% 200%; border: none; color: #fff;
    border-radius: var(--idx4-radius-sm); font-size: 1rem; font-weight: 700;
    position: relative; overflow: hidden;
    transition: all 0.35s ease;
    box-shadow: 0 4px 15px rgba(var(--idx4-primary-rgb),0.25);
}
.idx4-btn-primary::before {
    content: ''; position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    transition: left 0.5s ease;
}
.idx4-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--idx4-primary-rgb),0.35); color: #fff;
}
.idx4-btn-primary:hover::before { left: 100%; }
.idx4-btn-primary:active { transform: translateY(0); }

.idx4-btn-outline {
    background: transparent; border: 1.5px solid var(--idx4-border);
    color: var(--idx4-text-muted); border-radius: var(--idx4-radius-sm);
    font-size: 1rem; font-weight: 600; transition: all 0.3s ease;
}
.idx4-btn-outline:hover {
    background: #f0fdf4; border-color: var(--idx4-primary);
    color: var(--idx4-primary); transform: translateY(-1px);
}

/* --- Links --- */
.idx4-link {
    color: var(--idx4-text-muted); text-decoration: none; font-weight: 600;
    font-size: 0.875rem; transition: color 0.3s ease; position: relative; padding-bottom: 2px;
}
.idx4-link::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px;
    background: linear-gradient(90deg, var(--idx4-primary), var(--idx4-primary-light));
    transition: width 0.3s ease; border-radius: 1px;
}
.idx4-link:hover { color: var(--idx4-primary); }
.idx4-link:hover::after { width: 100%; }

/* --- Trust Footer --- */
.idx4-trust-footer {
    padding-top: 1rem; margin-top: 1.5rem;
    border-top: 1px solid var(--idx4-border);
    color: var(--idx4-text-light); font-size: 0.8rem;
}
.idx4-trust-footer i { color: var(--idx4-success); }

.idx4-form-text { color: var(--idx4-text-light); font-size: 0.8rem; }
#login-status-msg { color: #dc3545; font-size: 0.875rem; font-weight: 500; min-height: 1.2rem; }

/* --- Registration Overrides --- */
.idx4-register-container .form-control,
.idx4-register-container .form-select {
    background: var(--idx4-input-bg); border: 1.5px solid var(--idx4-input-border);
    border-radius: var(--idx4-radius-sm); transition: all 0.3s ease;
}
.idx4-register-container .form-control:focus,
.idx4-register-container .form-select:focus {
    background: #fff; border-color: var(--idx4-primary);
    box-shadow: 0 0 0 3px rgba(var(--idx4-primary-rgb),0.1);
}
.idx4-register-container label { color: var(--idx4-text-muted); font-size: 0.875rem; font-weight: 500; }
.idx4-register-container .btn-primary {
    background: linear-gradient(135deg, var(--idx4-primary), var(--idx4-primary-dark));
    border: none; border-radius: var(--idx4-radius-sm);
    box-shadow: 0 4px 15px rgba(var(--idx4-primary-rgb),0.25);
    font-weight: 700; transition: all 0.35s ease;
}
.idx4-register-container .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--idx4-primary-rgb),0.35);
}
.idx4-register-container .form-check-input:checked { background-color: var(--idx4-primary); border-color: var(--idx4-primary); }
.idx4-register-container a { color: var(--idx4-primary); font-weight: 600; }

/* --- Footer --- */
.idx4-footer {
    background: #0f172a; padding: 0.6rem 0; flex-shrink: 0; z-index: 1040;
}
.idx4-footer .nav-link {
    color: rgba(255,255,255,0.55) !important; font-size: 0.82rem; font-weight: 500;
    padding: 0.35rem 0.75rem; border-radius: 50px; transition: all 0.3s ease;
}
.idx4-footer .nav-link:hover { color: #fff !important; background: rgba(255,255,255,0.08); }
.idx4-footer .navbar-toggler-icon { filter: invert(1); }
.idx4-footer-text { color: rgba(255,255,255,0.35); font-size: 0.78rem; }

/* --- Animations --- */
@keyframes idx4FadeInUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}
.idx4-stagger-1 { animation: idx4FadeInUp 0.5s ease-out 0.05s both; }
.idx4-stagger-2 { animation: idx4FadeInUp 0.5s ease-out 0.15s both; }
.idx4-stagger-3 { animation: idx4FadeInUp 0.5s ease-out 0.25s both; }
.idx4-stagger-4 { animation: idx4FadeInUp 0.5s ease-out 0.35s both; }
.idx4-stagger-5 { animation: idx4FadeInUp 0.5s ease-out 0.45s both; }
.idx4-stagger-6 { animation: idx4FadeInUp 0.5s ease-out 0.55s both; }

.grecaptcha-badge { z-index: 9999 !important; }

@media (max-width: 991.98px) {
    .idx4-topbar { padding: 0.85rem 1.25rem; }
    .idx4-form-content { padding: 1rem 1.25rem; }
}
@media (max-width: 575.98px) {
    .idx4-title { font-size: 1.35rem; }
    .idx4-header-icon { width: 50px; height: 50px; }
    .idx4-header-icon i { font-size: 1.3rem; }
    .idx4-nav-pills .nav-link { font-size: 0.8rem; padding: 0.5rem 0.75rem; }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ============================================================
   DARK MODE
   ============================================================ */
[data-bs-theme="dark"] {
    --idx4-text: #e2e8f0;
    --idx4-text-muted: #94a3b8;
    --idx4-text-light: #64748b;
    --idx4-border: rgba(255,255,255,0.08);
    --idx4-input-bg: #161926;
    --idx4-input-border: rgba(255,255,255,0.1);
    --aff-text: #e2e8f0;
    --aff-text-muted: #94a3b8;
    --aff-input-bg: #161926;
    --aff-input-border: rgba(255,255,255,0.1);
    --aff-card-bg: #1a1d2e;
}
[data-bs-theme="dark"] body {
    background: #0f1117 !important;
    color: #e2e8f0 !important;
}
[data-bs-theme="dark"] .forny-container,
[data-bs-theme="dark"] .forny-form {
    color: #e2e8f0 !important;
}
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .forny-container .card {
    background: #1a1d2e !important;
    border-color: rgba(255,255,255,0.08) !important;
}
[data-bs-theme="dark"] h1, [data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3, [data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5, [data-bs-theme="dark"] h6 {
    color: #f1f5f9 !important;
}
[data-bs-theme="dark"] .form-control {
    background: #161926 !important;
    color: #e2e8f0 !important;
    border-color: rgba(255,255,255,0.1) !important;
}
[data-bs-theme="dark"] label:not(.form-floating > label) {
    color: #cbd5e1 !important;
}
[data-bs-theme="dark"] .form-floating > label {
    color: #94a3b8 !important;
}
[data-bs-theme="dark"] .form-control:focus ~ label,
[data-bs-theme="dark"] .form-control:not(:placeholder-shown) ~ label {
    color: var(--aff-primary, #4361ee) !important;
    opacity: 1 !important;
}
[data-bs-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}
[data-bs-theme="dark"] a:not(.btn) {
    color: #93c5fd;
}

/* Index4-specific dark overrides */
[data-bs-theme="dark"] .idx4-form-pane {
    background: #0f1117;
}
[data-bs-theme="dark"] .idx4-image-pane {
    background-color: #0c1220;
}
[data-bs-theme="dark"] .idx4-image-pane::before {
    background: linear-gradient(135deg, rgba(5,150,105,0.1) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.6) 100%);
}
[data-bs-theme="dark"] .idx4-nav-pills {
    background: #161926;
    border-color: rgba(255,255,255,0.08);
}
[data-bs-theme="dark"] .idx4-btn-outline {
    border-color: rgba(255,255,255,0.1);
    color: #94a3b8;
}
[data-bs-theme="dark"] .idx4-btn-outline:hover {
    background: rgba(5,150,105,0.08);
    border-color: var(--idx4-primary);
    color: var(--idx4-primary);
}
[data-bs-theme="dark"] .language-changer > a {
    background: #161926;
    color: #e2e8f0;
    border-color: rgba(255,255,255,0.08);
}
[data-bs-theme="dark"] .dropdown-menu.country-wrap,
[data-bs-theme="dark"] .country-wrap.dropdown-menu {
    background: #1a1d2e;
    border-color: rgba(255,255,255,0.08);
}
[data-bs-theme="dark"] .country-wrap .dropdown-item {
    color: #e2e8f0;
}
[data-bs-theme="dark"] .country-wrap .dropdown-item:hover {
    background: rgba(5,150,105,0.1);
}
[data-bs-theme="dark"] .idx4-input:focus {
    background: #1a1d2e !important;
}
[data-bs-theme="dark"] .idx4-info-banner {
    background: linear-gradient(135deg, rgba(5,150,105,0.08), rgba(13,148,136,0.05));
    border-color: rgba(5,150,105,0.15);
}
[data-bs-theme="dark"] .idx4-register-container .form-control:focus,
[data-bs-theme="dark"] .idx4-register-container .form-select:focus {
    background: #1a1d2e;
}
[data-bs-theme="dark"] .idx4-register-container .form-select {
    background-color: #161926;
    color: #e2e8f0;
    border-color: rgba(255,255,255,0.1);
}
[data-bs-theme="dark"] .modal-content {
    background: #1a1d2e !important;
    color: #e2e8f0;
    border-color: rgba(255,255,255,0.08);
}
[data-bs-theme="dark"] .modal-header {
    border-color: rgba(255,255,255,0.08);
}
[data-bs-theme="dark"] .modal-footer {
    border-color: rgba(255,255,255,0.08);
}
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
}
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}
