/* Real Estate CRM - Modern Theme (primary actions align with chat & lead widgets — blue) */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --menu-primary: #2563eb;
    --brand-rgb: 37, 99, 235;
    --brand-600: #2563eb;
    --brand-500: #3b82f6;
    --brand-700: #1d4ed8;
    --card-bg: rgba(30, 41, 59, 0.8);
    --card-border: rgba(148, 163, 184, 0.1);
    --rainbow-gradient: linear-gradient(90deg,
        #ff0000 0%, #ff8000 14%, #ffff00 28%, #80ff00 42%,
        #00ff00 57%, #00ff80 71%, #00ffff 85%, #0080ff 100%
    );
}

body.dark, .dark {
    background: #0f172a !important;
    color: #f8fafc !important;
}

html, body { overflow-x: hidden; }

.app-logo, .app-favicon { object-fit: contain !important; max-width: 100%; max-height: 100%; }

/* Rainbow Card - Animated border, dark theme */
.rainbow-card, .stat-card {
    position: relative;
    background: #1e293b !important;
    color: #f8fafc !important;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(148, 163, 184, 0.15);
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* reCAPTCHA / Turnstile need visible overflow or their iframe challenge is clipped / blank */
.rainbow-card:has(.captcha-widget),
.stat-card:has(.captcha-widget) {
    overflow: visible;
}
.captcha-widget {
    position: relative;
    z-index: 20;
    overflow: visible;
    min-height: 78px;
}
.captcha-widget .g-recaptcha,
.captcha-widget .cf-turnstile {
    display: inline-block;
    max-width: 100%;
}
.captcha-widget iframe {
    max-width: 100%;
}

.rainbow-card h2, .rainbow-card h3, .rainbow-card p, .rainbow-card span, .rainbow-card a,
.rainbow-card td, .rainbow-card th, .rainbow-card label,
.stat-card h2, .stat-card h3, .stat-card p, .stat-card span, .stat-card a,
.stat-card td, .stat-card th, .stat-card label { color: #f8fafc !important; }

.rainbow-card .text-gray-400, .rainbow-card .text-gray-500, .rainbow-card th,
.stat-card .text-gray-400, .stat-card .text-gray-500, .stat-card th { color: #94a3b8 !important; }

.rainbow-card a:hover, .stat-card a:hover { color: #d4b8ff !important; }

.rainbow-card .text-purple-400, .stat-card .text-purple-400 { color: #bc97fb !important; }
.rainbow-card .text-blue-400, .stat-card .text-blue-400 { color: #60a5fa !important; }
.rainbow-card .text-green-500, .stat-card .text-green-500 { color: #34d399 !important; }
.rainbow-card .text-amber-400, .stat-card .text-amber-400 { color: #fbbf24 !important; }
.rainbow-card .text-emerald-400, .stat-card .text-emerald-400 { color: #34d399 !important; }

.rainbow-card::before, .stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--rainbow-gradient);
    background-size: 200% 100%;
    animation: rainbow-flow 3s linear infinite;
}

@keyframes rainbow-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.rainbow-card:hover, .stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.rainbow-card:hover::before, .stat-card:hover::before {
    animation-duration: 1.5s;
    height: 5px;
}

.sidebar-gradient {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
    border-right: 1px solid rgba(148, 163, 184, 0.1);
}

.sidebar-gradient .menu-heading { color: #bc97fb !important; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.75rem; }

body:not(.dark) .rainbow-card, body:not(.dark) .stat-card {
    background: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, rgba(var(--brand-rgb), 0.92) 0%, rgba(var(--brand-rgb), 0.72) 100%);
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.35),
        inset 0 -2px 4px rgba(0, 0, 0, 0.28),
        0 4px 14px rgba(0, 0, 0, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.35),
        inset 0 -2px 4px rgba(0, 0, 0, 0.28),
        0 8px 20px rgba(var(--brand-rgb), 0.35);
    color: white !important;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
}

.form-input {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #111827;
    padding: 0.75rem 1rem;
    width: 100%;
}

.dark .form-input { background: #374151; border-color: #4b5563; color: #f9fafb; }
.form-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.22); }
select.form-input { appearance: menulist; cursor: pointer; min-height: 2.5rem; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1e293b; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }

@media (max-width: 640px) { .rainbow-card, .stat-card { padding: 1rem; } }
.sidebar-menu-scroll { flex: 1 1 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 768px) {
    .hero-slider .hero-prev, .hero-slider .hero-next { width: 40px; height: 40px; left: 8px; right: 8px; font-size: 0.875rem; }
}
@media (max-width: 640px) {
    .hero-slider .hero-prev, .hero-slider .hero-next { width: 36px; height: 36px; left: 4px; right: 4px; }
}
.table-responsive table {
    width: max-content;
    min-width: 100%;
}

/* Scroll-to-top FAB — safe area on notched phones */
.scroll-to-top-fab {
    bottom: max(5.5rem, calc(4.5rem + env(safe-area-inset-bottom, 0px)));
    z-index: 10060;
    touch-action: manipulation;
}

@media (max-width: 1023px) {
    .scroll-to-top-fab {
        bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
    }
}

/* Admin dashboard — denser stat cards so KPIs sit above the fold */
.dashboard-stat-grid .stat-card {
    padding: 0.75rem 0.875rem;
}
.dashboard-stat-grid .stat-card .text-3xl {
    font-size: 1.375rem !important;
    line-height: 1.75rem;
    margin-top: 0.125rem;
}
.dashboard-stat-grid .stat-card .text-2xl {
    font-size: 1.125rem !important;
    line-height: 1.5rem;
}
.dashboard-stat-grid .stat-card .text-sm {
    font-size: 0.6875rem !important;
    letter-spacing: 0.04em;
}
.dashboard-stat-grid .stat-card .w-12 {
    width: 2.25rem !important;
    height: 2.25rem !important;
}
.dashboard-stat-grid .stat-card .text-xl {
    font-size: 0.875rem !important;
}
.dashboard-stat-grid .stat-card a.text-sm {
    font-size: 0.6875rem !important;
    margin-top: 0.375rem;
}
.dashboard-stat-grid .stat-card .text-xs {
    font-size: 0.625rem !important;
}

/* Customer dashboard — payment reminders */
.payment-reminders-section {
    margin-bottom: 1.5rem;
}

.payment-reminders-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fbbf24 !important;
}

.payment-reminders-heading i {
    color: #fbbf24 !important;
    font-size: 0.875rem;
}

.payment-reminders-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.payment-reminder-card {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.14);
    overflow: hidden;
}

.payment-reminder-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #fbbf24 0%, #22c55e 100%);
    animation: none;
}

.payment-reminder-card__title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #f8fafc !important;
    line-height: 1.4;
}

.payment-reminder-card__meta,
.payment-reminder-card__due {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: #94a3b8 !important;
    line-height: 1.45;
}

.payment-reminder-card__due i {
    margin-right: 0.35rem;
    color: #94a3b8 !important;
}

.payment-reminder-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.payment-reminder-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.payment-reminder-btn--view {
    background: transparent;
    border: 1px solid rgba(248, 250, 252, 0.35);
    color: #f8fafc !important;
}

.payment-reminder-btn--view:hover {
    background: rgba(248, 250, 252, 0.08);
    border-color: rgba(248, 250, 252, 0.55);
    color: #f8fafc !important;
}

.payment-reminder-btn--pay {
    background: #16a34a;
    border: 1px solid #16a34a;
    color: #ffffff !important;
    font-weight: 600;
}

.payment-reminder-btn--pay:hover {
    background: #15803d;
    border-color: #15803d;
    color: #ffffff !important;
}

@media (max-width: 640px) {
    .payment-reminder-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .payment-reminder-card__actions {
        width: 100%;
    }

    .payment-reminder-btn {
        flex: 1;
    }
}

/* ── Global glass + embossed buttons ── */
button,
input[type="submit"],
input[type="button"],
input[type="reset"],
a.btn-primary {
    border-radius: 50px !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:not(.btn-primary):not([class*="bg-"]):not(.payment-reminder-btn),
input[type="submit"]:not(.btn-primary):not([class*="bg-"]),
input[type="button"]:not([class*="bg-"]) {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.35),
        inset 0 -2px 4px rgba(0, 0, 0, 0.28),
        0 4px 14px rgba(0, 0, 0, 0.25);
}

button:not(.btn-primary)[class*="bg-"],
input[type="submit"]:not(.btn-primary)[class*="bg-"],
input[type="button"][class*="bg-"] {
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.25),
        inset 0 -2px 4px rgba(0, 0, 0, 0.22),
        0 4px 12px rgba(0, 0, 0, 0.2);
}

button:hover:not(:disabled),
input[type="submit"]:hover:not(:disabled),
input[type="button"]:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:active:not(:disabled),
input[type="submit"]:active:not(:disabled),
input[type="button"]:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ── Sidebar section headings: glass + emboss + individual shadow ── */
.sidebar-gradient summary.menu-heading {
    border-radius: 12px;
    margin: 0.35rem 0.5rem;
    padding: 0.5rem 0.75rem !important;
    background: rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35),
        0 4px 10px rgba(0, 0, 0, 0.28);
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.12),
        0 -1px 1px rgba(0, 0, 0, 0.45);
}

.sidebar-gradient summary.menu-heading:hover {
    background: rgba(var(--brand-rgb), 0.15) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3),
        0 6px 14px rgba(var(--brand-rgb), 0.25);
}

.sidebar-gradient .menu-item {
    border-radius: 50px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-gradient a.menu-item:hover,
.sidebar-gradient a[class*="menu-item"]:hover {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-gradient a.text-white.bg-purple-600,
.sidebar-gradient a.bg-purple-600 {
    border-radius: 50px !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2),
        0 3px 10px rgba(var(--brand-rgb), 0.35);
}

/* Compact sidebar — tighter gaps so all section headers fit without scrolling */
.sidebar-gradient nav {
    margin-top: 0.375rem !important;
    padding-bottom: 0.375rem !important;
}
.sidebar-gradient nav > div.pt-4,
.sidebar-gradient nav details.pt-4,
.sidebar-gradient nav details.group {
    padding-top: 0.125rem !important;
}
.sidebar-gradient summary.menu-heading {
    margin: 0.08rem 0.35rem !important;
    padding: 0.28rem 0.55rem !important;
    border-radius: 8px;
    min-height: 0;
    line-height: 1.25;
}
.sidebar-gradient nav a[class*="py-2"],
.sidebar-gradient nav summary[class*="py-2"] {
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
}
.sidebar-gradient nav .mt-1 {
    margin-top: 0.125rem !important;
}
