/* 
* Main CSS file for AVID real estate website
* Author: AVID Development Team
*/

/* ===== General Styles ===== */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

html[data-bs-theme="dark"] {
    --primary-bg: #121212;
    --secondary-bg: #1e1e1e;
    --card-bg: #252525;
    --text-color: #e0e0e0;
    --border-color: #333;
}

body {
    font-family: 'Vazirmatn', tahoma, sans-serif !important;
    background-color: #f9f9f9;
    direction: rtl;
    text-align: right;
    line-height: 1.6;
}

/* Dark mode overrides */
html[data-bs-theme="dark"] body {
    background-color: var(--primary-bg);
    color: var(--text-color);
}

html[data-bs-theme="dark"] .card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-bs-theme="dark"] .bg-light {
    background-color: var(--secondary-bg) !important;
}

/* Comprehensive Dark Mode Text Colors */
html[data-bs-theme="dark"] .card-title {
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .card-text {
    color: #cccccc !important;
}

html[data-bs-theme="dark"] .property-title {
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .property-price {
    color: #4dabf7 !important;
}

html[data-bs-theme="dark"] .property-location {
    color: #aaaaaa !important;
}

html[data-bs-theme="dark"] .property-details {
    color: #cccccc !important;
}

html[data-bs-theme="dark"] .section-title {
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .hero-title {
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .hero-subtitle {
    color: #e0e0e0 !important;
}

html[data-bs-theme="dark"] .form-label {
    color: #cccccc !important;
}

html[data-bs-theme="dark"] .form-control {
    background-color: var(--secondary-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-bs-theme="dark"] .form-control:focus {
    background-color: var(--secondary-bg);
    border-color: var(--primary-color);
    color: var(--text-color);
    box-shadow: 0 0 0 0.2rem rgba(77, 171, 247, 0.25);
}

html[data-bs-theme="dark"] .form-select {
    background-color: var(--secondary-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-bs-theme="dark"] .footer {
    background-color: var(--secondary-bg) !important;
    color: var(--text-color);
}

html[data-bs-theme="dark"] .footer h5 {
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .footer a {
    color: #4dabf7;
}

html[data-bs-theme="dark"] .footer a:hover {
    color: #74c0fc;
}

html[data-bs-theme="dark"] .list-group-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-bs-theme="dark"] .table {
    color: var(--text-color);
}

html[data-bs-theme="dark"] .table th {
    color: #ffffff;
    border-color: var(--border-color);
}

html[data-bs-theme="dark"] .table td {
    border-color: var(--border-color);
}

html[data-bs-theme="dark"] .modal-content {
    background-color: var(--card-bg);
    color: var(--text-color);
}

html[data-bs-theme="dark"] .modal-header {
    border-color: var(--border-color);
}

html[data-bs-theme="dark"] .modal-footer {
    border-color: var(--border-color);
}

html[data-bs-theme="dark"] .alert {
    color: var(--text-color);
}

html[data-bs-theme="dark"] .search-form {
    background-color: var(--card-bg) !important;
    color: var(--text-color);
}

/* Additional navbar dark mode styles */
html[data-bs-theme="dark"] .navbar {
    background-color: var(--secondary-bg) !important;
}

html[data-bs-theme="dark"] .navbar-nav .nav-link {
    color: var(--text-color) !important;
    white-space: nowrap;
}

html[data-bs-theme="dark"] .navbar-nav .nav-link:hover {
    color: #4dabf7 !important;
}

html[data-bs-theme="dark"] .navbar-brand {
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .navbar-toggler {
    border-color: var(--border-color);
}

html[data-bs-theme="dark"] .dropdown-menu {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

html[data-bs-theme="dark"] .dropdown-item {
    color: var(--text-color);
}

html[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: var(--secondary-bg);
    color: #4dabf7;
}

/* Buttons in dark mode */
html[data-bs-theme="dark"] .btn-outline-primary {
    color: #4dabf7;
    border-color: #4dabf7;
}

html[data-bs-theme="dark"] .btn-outline-primary:hover {
    background-color: #4dabf7;
    color: #ffffff;
}

/* Links in dark mode */
html[data-bs-theme="dark"] a {
    color: #4dabf7;
}

html[data-bs-theme="dark"] a:hover {
    color: #74c0fc;
}

/* ===== Header Styles ===== */
.top-bar {
    font-size: 0.875rem;
}

.navbar-brand img {
    max-height: 50px;
    width: auto;
}

.navbar {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    position: relative;
}

.navbar .container {
    position: relative;
}

/* Ensure navbar items stay in one line */
.navbar-nav {
    flex-direction: row;
    flex-wrap: nowrap;
}

.navbar-nav .nav-item {
    white-space: nowrap;
}

.navbar-nav .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 0.8rem !important;
    white-space: nowrap;
}

/* Desktop navbar - prevent text wrapping */
@media (min-width: 993px) {
    .navbar-nav {
        flex-direction: row;
        flex-wrap: nowrap;
    }
    
    .navbar-nav .nav-item {
        white-space: nowrap;
    }
    
    .navbar-nav .nav-link {
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem !important;
    }
}

/* Smaller screens but still desktop */
@media (max-width: 1200px) and (min-width: 993px) {
    .navbar-nav .nav-link {
        font-size: 0.85rem;
        padding: 0.5rem 0.6rem !important;
    }
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
    font-weight: 700;
}

/* ===== Footer Styles ===== */
footer {
    padding-top: 3rem;
    padding-bottom: 1rem;
}

footer a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover {
    color: var(--primary-color);
}

/* ===== Property Card Styles ===== */
.property-card {
    border-radius: 8px;
    overflow: hidden;
}

.property-card .card-img-top {
    height: 200px;
    object-fit: cover;
}

.property-features {
    color: var(--secondary-color);
}

/* ===== Form Styles ===== */
.form-control, .form-select {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ===== Button Styles ===== */
.btn {
    border-radius: 0.25rem;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0a58ca;
    border-color: #0a53be;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* ===== Badge Styles ===== */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* ===== Animation Classes ===== */
.fade-in {
    animation: fadeIn 1s ease-in-out;
}

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

/* ===== Responsive Styles ===== */
@media (max-width: 992px) {
    .navbar-collapse {
        background-color: white;
        padding: 1rem;
        border-radius: 0.5rem;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        margin-top: 0.5rem;
        /* Ensure menu opens top-to-bottom, not right-to-left */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        -webkit-transform: none !important;
        z-index: 1000;
    }
    
    /* Ensure navbar-nav displays vertically on mobile */
    @media (max-width: 992px) {
        .navbar-collapse .navbar-nav {
            flex-direction: column !important;
            width: 100%;
        }
        
        .navbar-collapse .navbar-nav .nav-item {
            width: 100%;
        }
        
        .navbar-collapse .navbar-nav .nav-link {
            width: 100%;
            text-align: right;
            padding: 0.75rem 1rem !important;
        }
    }
    
    html[data-bs-theme="dark"] .navbar-collapse {
        background-color: var(--card-bg);
    }
    
    .property-card .card-img-top {
        height: 180px;
    }
}

@media (max-width: 768px) {
    .banner-section h1 {
        font-size: 2rem;
    }
    
    .banner-section p.lead {
        font-size: 1rem;
    }
    
    .property-card .card-img-top {
        height: 160px;
    }

/* ===== Saved Property & Share Enhancements ===== */
.property-save-toggle {
    border: none;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: #0d6efd;
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.property-save-toggle i {
    pointer-events: none;
}

.property-save-toggle-floating {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 5;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    background-color: rgba(255, 255, 255, 0.95);
}

.property-save-toggle-inline {
    border-radius: 999px;
    padding-inline: 0.85rem;
    background-color: var(--bs-body-bg, #fff);
}

.property-save-toggle[aria-pressed="true"],
.property-save-toggle[data-is-saved="true"] {
    color: #dc3545;
}

.property-save-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
}

.property-share-block .btn {
    min-height: 42px;
    font-weight: 500;
}

.share-copy-btn {
    color: #495057;
}

.saved-property-card img {
    height: 160px;
    object-fit: cover;
}

/* ===== Password Visibility Toggle ===== */
.password-field-wrapper {
    position: relative;
    width: 100%;
}

.password-field-wrapper .password-field-control {
    width: 100%;
    padding-left: 2.75rem;
}

[dir="ltr"] .password-field-wrapper .password-field-control {
    padding-left: 1rem;
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%) translateY(-1px);
    border: none;
    background: transparent;
    color: #6c757d;
    padding: 0.375rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    /* Ensure proper touch target size on mobile */
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    /* Keep button within input bounds */
    margin: 0;
}

[dir="ltr"] .password-toggle-btn {
    left: auto;
    right: 0.5rem;
}

.password-toggle-btn:focus {
    outline: none;
    box-shadow: none;
}

.password-toggle-btn:active {
    opacity: 0.7;
}

/* Ensure icon is properly sized */
.password-toggle-btn i {
    font-size: 1.1rem;
    pointer-events: none;
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    .password-toggle-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0.5rem !important;
        left: 0.4rem !important;
        top: 35% !important;
        transform: translateY(-50%) !important;
    }
    
    [dir="ltr"] .password-toggle-btn {
        left: auto !important;
        right: 0.4rem !important;
    }
    
    .password-toggle-btn i {
        font-size: 1.15rem;
    }
    
    .password-field-wrapper .password-field-control {
        padding-left: 2.5rem;
    }
    
    [dir="ltr"] .password-field-wrapper .password-field-control {
        padding-right: 2.5rem;
    }
}

[data-bs-theme="dark"] .property-save-toggle {
    background-color: rgba(33, 37, 41, 0.9);
    color: #f8f9fa;
}
    
    /* Better mobile spacing */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Larger touch targets */
    .btn, .nav-link, a.btn {
        min-height: 44px;
        padding: 10px 15px;
    }
    
    /* Prevent zoom on input focus (iOS) */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    /* Better card spacing on mobile */
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    /* Improve table readability on mobile */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better form spacing */
    .form-group, .mb-3 {
        margin-bottom: 1rem !important;
    }
    
    /* Improve button groups */
    .btn-group {
        display: flex;
        flex-wrap: wrap;
    }
    
    .btn-group .btn {
        flex: 1;
        min-width: 0;
    }
    
    /* Better navbar on mobile */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-brand img {
        max-height: 40px;
    }
    
    /* Improve footer on mobile */
    footer {
        padding-top: 2rem;
        padding-bottom: 1rem;
    }
    
    footer .row > div {
        margin-bottom: 1.5rem;
    }
    
    /* Better text readability */
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.9rem; }
    
    /* Better list spacing */
    ul, ol {
        padding-right: 1.5rem;
    }
    
    /* Improve images on mobile */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Better modal on mobile */
    .modal-dialog {
        margin: 10px;
    }
    
    /* Improve dropdowns on mobile */
    .dropdown-menu {
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== Custom Helpers ===== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shadow-hover {
    transition: box-shadow 0.3s ease-in-out;
}

.shadow-hover:hover {
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15) !important;
}
