/* ========================================
   AQARI - Custom Styles (extends style.css)
======================================== */

/* ========================================
   DARK MODE
======================================== */
:root[data-theme="dark"] {
    --white: #17171F;
    --gray-light: #1F1F2B;
    --text: #E4E4E8;
    --gray: #9A9AA6;
    --gray-dark: #C8C8D0;
    --border: #33333F;
    --shadow: 0 4px 20px rgba(0,0,0,0.35);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.5);
}
:root[data-theme="dark"] img:not(.logo-icon img) { filter: brightness(0.85); }

.dark-mode-toggle { background: none; border: 1px solid var(--border); color: var(--gray-dark); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: var(--transition); }
.dark-mode-toggle:hover { border-color: var(--gold); color: var(--gold); }

/* Notifications */
.notif-wrap { position: relative; }
.notif-badge { position: absolute; top: -4px; left: -4px; background: #E53935; color: white; font-size: 0.65rem; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.notif-dropdown { position: absolute; top: 48px; left: 0; width: 320px; max-width: 90vw; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-hover); z-index: 1200; overflow: hidden; }
.notif-dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-dropdown-head strong { font-size: 0.92rem; color: var(--text); }
.notif-dropdown-head button { background: none; border: none; color: var(--gold); font-size: 0.75rem; cursor: pointer; }
.notif-dropdown-body { max-height: 340px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--gray-light); }
.notif-item.unread { background: rgba(200,168,107,0.08); }
.notif-item i { color: var(--gold); margin-top: 3px; }
.notif-item p { font-size: 0.85rem; margin: 0; }
.notif-item small { color: var(--gray); font-size: 0.75rem; }
.notif-empty { text-align: center; padding: 30px 16px; color: var(--gray); font-size: 0.85rem; margin: 0; }

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 44px;
    height: 44px;
    background: var(--gold);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(200,168,107,0.4);
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 998;
    font-size: 1rem;
}

.scroll-top-btn:hover {
    background: var(--gold-dark);
    transform: translateY(-3px);
}

/* Animation Classes */
.property-card,
.stat-card,
.mission-card,
.type-card,
.blog-article-card,
.team-card {
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.property-card:nth-child(2) { animation-delay: 0.1s; }
.property-card:nth-child(3) { animation-delay: 0.2s; }
.property-card:nth-child(4) { animation-delay: 0.3s; }
.property-card:nth-child(5) { animation-delay: 0.4s; }
.property-card:nth-child(6) { animation-delay: 0.5s; }

/* Loading Spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.loading-spinner::after {
    content: '';
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-light); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }

/* Print Styles */
@media print {
    .site-header, .site-footer, .whatsapp-float, .scroll-top-btn,
    .property-favorite, .share-card, .contact-card { display: none !important; }
    .property-detail-layout { grid-template-columns: 1fr; }
}

/* Focus styles for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Image Placeholder */
.img-placeholder {
    background: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
}

/* Tag / Label */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--gray-light);
    color: var(--gray-dark);
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 90px;
    left: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-right: 4px solid var(--gold);
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.toast.success { border-right-color: #4CAF50; }
.toast.error   { border-right-color: #f44336; }

/* Map Placeholder */
.map-placeholder {
    width: 100%;
    height: 300px;
    background: var(--gray-light);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray);
}

.map-placeholder i {
    font-size: 3rem;
    color: var(--gold);
    margin-bottom: 12px;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border);
    min-width: 180px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 100;
}

.dropdown:hover .dropdown-menu,
.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text);
    font-size: 0.88rem;
    transition: var(--transition);
}

.dropdown-menu a:hover {
    background: var(--gray-light);
    color: var(--gold);
}

/* Tabs */
.tabs-container { }
.tabs-header {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* RTL specific fixes */
[dir="rtl"] .fa-chevron-left::before { content: "\f054"; }
[dir="rtl"] .form-control[type="number"] { text-align: right; }

/* WordPress Classes */
.alignleft { float: right; margin-left: 20px; }
.alignright { float: left; margin-right: 20px; }
.aligncenter { display: block; margin: 0 auto 20px; }
.wp-caption { max-width: 100%; }
.screen-reader-text { position: absolute; left: -9999px; }

/* Property Card Actions */
.property-card-actions { display: flex; gap: 8px; margin-top: 14px; }
.property-card-details { flex: 1; text-align: center; }
.property-card-whatsapp { width: 38px; height: 38px; flex-shrink: 0; border: 1px solid #25D366; color: #25D366; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.05rem; transition: var(--transition); }
.property-card-whatsapp:hover { background: #25D366; color: white; }

/* Compare Properties */
.property-compare-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--gray);
    cursor: pointer;
}
.property-compare-check input { accent-color: var(--gold); cursor: pointer; }

.aqari-compare-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 12px 18px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 999;
    font-size: 0.9rem;
}
.aqari-compare-clear {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
}
.aqari-compare-clear:hover { background: rgba(255,255,255,0.3); }

/* ── nav-add-btn: compact pill ── */
.nav-add-btn {
    padding: 5px 13px !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    border-radius: 20px !important;
    gap: 5px !important;
    letter-spacing: 0.01em;
}

/* ========================================
   RESPONSIVE — Mobile First Additions
======================================== */

/* ── Mobile header: icon-only buttons ── */
@media (max-width: 768px) {
    /* Hide text-only/redundant buttons; btn-outline-gold.btn-sm are kept as icon circles below */
    .nav-actions .btn:not(.btn-outline-gold.btn-sm),
    .nav-actions a.dark-mode-toggle,
    #darkModeToggle {
        display: none !important;
    }

    /* Dashboard / my-properties / service-requests → icon-only circles */
    .nav-actions .btn.btn-outline-gold.btn-sm {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        font-size: 0 !important;
        flex-shrink: 0;
        gap: 0 !important;
        overflow: hidden;
        min-width: 36px;
    }
    .nav-actions .btn.btn-outline-gold.btn-sm i {
        font-size: 0.9rem !important;
        margin: 0 !important;
    }

    .nav-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

    /* Keep bell visible */
    .nav-actions .notif-wrap {
        display: flex !important;
    }

    /* nav-add-btn: icon-only gold circle */
    .nav-add-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 38px !important;
        height: 38px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        font-size: 0 !important;   /* hide text */
        gap: 0 !important;
        flex-shrink: 0;
    }
    .nav-add-btn i {
        font-size: 1rem !important;
        margin: 0 !important;
    }

    /* nav-login: icon-only ghost circle */
    .nav-actions .nav-login {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 38px !important;
        height: 38px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        font-size: 0 !important;
        flex-shrink: 0;
    }
    .nav-actions .nav-login i {
        font-size: 1rem !important;
    }

    /* Hamburger button */
    .mobile-menu-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        background: rgba(255,255,255,0.08);
        border: 1px solid rgba(255,255,255,0.25);
        border-radius: var(--radius);
        color: #fff !important;
        font-size: 1.1rem;
        cursor: pointer;
        flex-shrink: 0;
    }
    .mobile-menu-btn:hover,
    .mobile-menu-btn:focus {
        background: var(--gold);
        border-color: var(--gold);
        color: white !important;
    }

    /* Notification dropdown: fixed full-width on mobile */
    .notif-dropdown {
        position: fixed !important;
        top: 65px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
        z-index: 9999 !important;
    }

    /* Navbar: prevent overflow */
    .navbar {
        flex-wrap: nowrap;
        overflow: visible;
    }

    .logo span {
        font-size: 0.9rem;
        max-width: 130px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ── Hero section ── */
@media (max-width: 768px) {
    .hero-section { min-height: 420px; }
    .hero-float-card { display: none !important; }
    .hero-float-contact { display: none !important; }
    .hero-search-box { padding: 16px; border-radius: var(--radius); }
    .hero-search-box h2 { font-size: 1.3rem; }
}

/* ── Tables: horizontal scroll on small screens ── */
@media (max-width: 768px) {
    .table-responsive,
    .admin-dash-table-wrap,
    .sr-table-wrap,
    .inq-table-wrap,
    .contracts-table-wrap,
    .crm-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table {
        min-width: 540px;
    }
    /* Dashboard sections wrapper tables */
    .admin-dash-content table { min-width: 480px; }
}

/* ── Admin dashboard layout ── */
@media (max-width: 900px) {
    .admin-dash-layout {
        flex-direction: column;
    }
    .admin-dash-sidebar {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px;
    }
    .admin-dash-nav-item {
        flex: 1 1 auto;
        min-width: 120px;
        text-align: center;
        padding: 8px 10px;
        font-size: 0.82rem;
    }
    .admin-dash-content {
        padding: 16px;
    }
}

/* ── Property detail page ── */
@media (max-width: 768px) {
    .property-detail-layout {
        grid-template-columns: 1fr;
    }
    .property-gallery-grid {
        grid-template-columns: 1fr;
    }
    .property-meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Service requests page ── */
@media (max-width: 768px) {
    .sr-detail-layout {
        grid-template-columns: 1fr;
    }
    .sr-message-thread {
        max-height: 320px;
    }
    .sr-msg-item { max-width: 90%; }
}

/* ── Auth page (login/register) ── */
@media (max-width: 480px) {
    .auth-box {
        padding: 24px 16px;
        border-radius: var(--radius);
    }
    .auth-tabs { gap: 0; }
    .auth-tab-btn { flex: 1; text-align: center; font-size: 0.88rem; }
}

/* ── Compare page ── */
@media (max-width: 768px) {
    .compare-table-wrap { overflow-x: auto; }
    .compare-table { min-width: 560px; }
    .aqari-compare-bar {
        left: 12px;
        right: 12px;
        transform: none;
        bottom: 12px;
        font-size: 0.82rem;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ── Footer ── */
@media (max-width: 480px) {
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
}

/* ── Buttons & forms on small screens ── */
@media (max-width: 480px) {
    .btn { padding: 8px 14px; font-size: 0.85rem; }
    .btn-lg { padding: 12px 20px; font-size: 0.95rem; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; text-align: center; }
}

/* ── Cards grid ── */
@media (max-width: 480px) {
    .services-grid,
    .type-cards-grid,
    .team-grid,
    .blog-grid {
        grid-template-columns: 1fr;
    }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── Sections padding ── */
@media (max-width: 480px) {
    .section { padding: 30px 0; }
    .section-header { margin-bottom: 24px; }
    .section-header h2 { font-size: 1.4rem; }
}

/* ── My properties / my requests pages ── */
@media (max-width: 768px) {
    .my-props-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .property-owner-card {
        flex-direction: column;
    }
}

/* ── User management buttons ── */
.btn-outline-green {
    border: 1px solid #2E7D32;
    color: #2E7D32;
    background: transparent;
}
.btn-outline-green:hover { background: #2E7D32; color: white; }

.btn-outline-red {
    border: 1px solid #C62828;
    color: #C62828;
    background: transparent;
}
.btn-outline-red:hover { background: #C62828; color: white; }

.btn-outline-gray {
    border: 1px solid var(--border);
    color: var(--gray);
    background: transparent;
}
.btn-outline-gray:hover { border-color: var(--gold); color: var(--gold); }

.user-actions-wrap { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

/* ── Scroll top button position on mobile ── */
@media (max-width: 768px) {
    .scroll-top-btn {
        bottom: 70px;
        left: 16px;
        width: 38px;
        height: 38px;
    }
}
