/* ManzelMasr Custom Styles - RTL Arabic */

/* Base Styles */
:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
}

/* Ensure proper box-sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Cairo', sans-serif;
    color: var(--text-color);
    background-color: #fff;
    line-height: 1.8;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
}

.notifications-dropdown {
    min-width: 300px;
    max-height: 400px;
    overflow-y: auto;
}

/* Buttons */
.btn {
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
}

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

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

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

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

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-img-top {
    border-radius: 12px 12px 0 0;
    height: 200px;
    object-fit: cover;
}

/* Broker Cards */
.broker-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.broker-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Broker Tags */
.broker-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center;
}

.broker-tag {
    font-size: 0.75em;
    font-weight: 500;
}

.broker-tag-sm {
    font-size: 0.65em;
    padding: 0.2em 0.5em;
}

/* Property Cards */
.property-card {
    position: relative;
}

.property-card .badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}

.property-card .favorite-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.property-card .favorite-btn:hover {
    background: #fff;
    transform: scale(1.1);
}

.property-card .favorite-btn.active {
    color: var(--danger-color);
}

.property-price {
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 700;
}

.property-features {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.property-features .feature {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    padding: 4rem 0;
    margin-bottom: 2rem;
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-search {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Stats Section */
.stats-section {
    padding: 3rem 0;
    background-color: var(--bg-light);
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Section Titles */
.section-title {
    position: relative;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border-color: var(--border-color);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.form-label {
    font-weight: 600;
    color: var(--text-color);
}

/* Property Detail */
.property-gallery {
    position: relative;
}

.property-gallery img {
    border-radius: 12px;
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.property-gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    overflow-x: auto;
}

.property-gallery-thumbs img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.property-gallery-thumbs img:hover,
.property-gallery-thumbs img.active {
    opacity: 1;
}

.property-info-card {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 1.5rem;
}

.property-info-card .info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.property-info-card .info-item:last-child {
    border-bottom: none;
}

.property-info-card .info-label {
    color: var(--text-muted);
}

.property-info-card .info-value {
    font-weight: 600;
}

/* Share Section */
.share-section {
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.share-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.btn-share:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.btn-share i {
    font-size: 1.1rem;
}

.btn-share-facebook {
    color: #1877f2;
    border-color: #1877f2;
}

.btn-share-facebook:hover {
    background: #1877f2;
    color: #fff;
}

.btn-share-whatsapp {
    color: #25d366;
    border-color: #25d366;
}

.btn-share-whatsapp:hover {
    background: #25d366;
    color: #fff;
}

.btn-share-twitter {
    color: #000;
    border-color: #333;
}

.btn-share-twitter:hover {
    background: #000;
    color: #fff;
}

.btn-share-linkedin {
    color: #0a66c2;
    border-color: #0a66c2;
}

.btn-share-linkedin:hover {
    background: #0a66c2;
    color: #fff;
}

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

.btn-share-copy:hover {
    background: var(--primary-color);
    color: #fff;
}

.btn-share-copied {
    background: var(--success-color) !important;
    color: #fff !important;
    border-color: var(--success-color) !important;
}

/* Contact Box */
.contact-box {
    background: #fff;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.contact-box h5 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Dashboard */
.dashboard-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.dashboard-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-stat .icon {
    width: 60px;
    height: 60px;
    background: var(--bg-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.dashboard-stat .info h3 {
    margin: 0;
    font-size: 1.75rem;
}

.dashboard-stat .info p {
    margin: 0;
    color: var(--text-muted);
}

/* Sidebar */
.sidebar {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.sidebar .nav-link {
    color: var(--text-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
}

.sidebar .nav-link:hover {
    background: var(--bg-light);
}

.sidebar .nav-link.active {
    background: var(--primary-color);
    color: #fff;
}

.sidebar .nav-link i {
    margin-left: 0.5rem;
    width: 20px;
}

/* Chat */
.chat-container {
    height: 500px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 12px;
}

.chat-message {
    display: flex;
    margin-bottom: 1rem;
}

.chat-message.own {
    flex-direction: row-reverse;
}

.chat-message .message-content {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-message.own .message-content {
    background: var(--primary-color);
    color: #fff;
}

.chat-message .message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.chat-message.own .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.chat-input {
    padding: 1rem;
    background: #fff;
    border-top: 1px solid var(--border-color);
}

/* Pagination */
.pagination {
    justify-content: center;
}

.page-link {
    border-radius: 8px;
    margin: 0 0.25rem;
    color: var(--text-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state .icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
}

/* Filter Sidebar */
.filter-sidebar {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filter-sidebar h5 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
}

/* Badges */
.badge.bg-sale {
    background-color: var(--success-color) !important;
}

.badge.bg-rent {
    background-color: var(--warning-color) !important;
}

.badge.bg-pending {
    background-color: var(--warning-color) !important;
}

.badge.bg-approved {
    background-color: var(--success-color) !important;
}

.badge.bg-rejected {
    background-color: var(--danger-color) !important;
}

.badge.bg-sold {
    background-color: #6366f1 !important;
}

.badge.bg-rented {
    background-color: #8b5cf6 !important;
}

.badge.bg-draft {
    background-color: #94a3b8 !important;
}

.btn-outline-purple {
    color: #8b5cf6;
    border-color: #8b5cf6;
}
.btn-outline-purple:hover, .btn-outline-purple:active {
    color: #fff;
    background-color: #8b5cf6;
    border-color: #8b5cf6;
}

/* Notifications */
.notification-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s;
}

.notification-item:hover {
    background: var(--bg-light);
}

.notification-item.unread {
    background: rgba(37, 99, 235, 0.05);
}

.notification-item .title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notification-item .message {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.notification-item .time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Toast */
.toast {
    z-index: 9999;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 1.75rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .property-gallery img {
        height: 250px;
    }

    .chat-container {
        height: 400px;
    }

    /* Container full width on mobile */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Small mobile devices */
@media (max-width: 576px) {
    /* Share buttons - icon only on small mobile */
    .btn-share {
        padding: 0.4rem 0.55rem;
    }

    /* Full width content on mobile */
    .container {
        padding-left: 10px;
        padding-right: 10px;
        max-width: 100%;
        width: 100%;
    }

    /* Ensure row takes full width */
    .row {
        margin-left: -10px;
        margin-right: -10px;
        width: calc(100% + 20px);
    }

    /* Ensure columns take full width */
    .row > [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Full width on mobile regardless of lg/md classes */
    .col-12, .col-lg-10, .col-lg-8, .col-md-10, .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }

    /* Cards should be full width with minimal margin */
    .card {
        border-radius: 8px;
        margin-left: 0;
        margin-right: 0;
    }

    .card-body {
        padding: 1rem;
    }

    /* Reduce overall padding */
    .py-5 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .py-4 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    /* Form sections */
    .form-section {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 8px;
    }

    /* Navbar adjustments */
    .navbar-brand {
        font-size: 1.25rem;
    }

    /* Footer compact on mobile */
    footer.py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    /* Hero section compact */
    .hero-section {
        padding: 2rem 0;
    }

    .hero-section h1 {
        font-size: 1.5rem;
    }

    .hero-search {
        padding: 1rem;
        border-radius: 8px;
    }

    /* Stat items */
    .stat-number {
        font-size: 1.5rem;
    }

    /* Property cards */
    .property-card .card-body {
        padding: 0.75rem;
    }

    .property-price {
        font-size: 1.1rem;
    }

    /* Dashboard cards */
    .dashboard-card {
        padding: 1rem;
    }

    .dashboard-stat .icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .dashboard-stat .info h3 {
        font-size: 1.5rem;
    }

    /* Filter sidebar on mobile */
    .filter-sidebar {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    /* Buttons full width on mobile */
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    /* Alerts compact */
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* ──────────────────────────────────────── */
/* Organization: Context Switcher          */
/* ──────────────────────────────────────── */
.context-switcher-menu {
    min-width: 280px;
}

.context-switcher-menu .dropdown-item {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin: 0 0.25rem;
}

.context-switcher-menu .dropdown-item.active {
    background-color: var(--bg-light);
    color: var(--primary-color);
    font-weight: 600;
}

.context-switcher-menu .dropdown-item:hover:not(.active) {
    background-color: #f8f9fa;
}

/* Org Context Badge (sidebar) */
.org-context-badge {
    background: var(--bg-light);
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 0.75rem;
}

/* ──────────────────────────────────────── */
/* Organization: Dashboard                 */
/* ──────────────────────────────────────── */
.org-stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.org-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

.org-stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Assignee Avatar Stack */
.avatar-stack {
    display: flex;
    flex-direction: row-reverse;
}

.avatar-stack .avatar-item {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    margin-right: -8px;
    object-fit: cover;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    color: var(--text-muted);
}

.avatar-stack .avatar-item:last-child {
    margin-right: 0;
}

.avatar-stack .avatar-more {
    background: var(--primary-color);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 600;
}

/* Org Properties Table */
.org-properties-table th {
    font-size: 0.813rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.org-properties-table td {
    vertical-align: middle;
}

.org-properties-table .prop-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}

/* Bulk Action Bar */
.bulk-action-bar {
    position: sticky;
    bottom: 0;
    background: var(--primary-color);
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 12px 12px 0 0;
    display: none;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.bulk-action-bar.show {
    display: flex;
}

/* Assignment Popover */
.assignment-popover {
    min-width: 240px;
}

.assignment-popover .form-check {
    padding: 0.375rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.assignment-popover .form-check:last-child {
    border-bottom: none;
}

.assignment-popover .form-check img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-left: 0.5rem;
}

/* Status badges for org review */
.badge.bg-org-pending {
    background-color: #f59e0b !important;
    color: #000;
}

.badge.bg-org-approved {
    background-color: #22c55e !important;
}

.badge.bg-org-rejected {
    background-color: #ef4444 !important;
}

/* ──────────────────────────────────────── */
/* Responsive: Organization                */
/* ──────────────────────────────────────── */
@media (max-width: 576px) {
    .context-switcher-menu {
        min-width: 100%;
        border-radius: 0;
    }

    .org-properties-table {
        font-size: 0.813rem;
    }

    .bulk-action-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
        border-radius: 0;
    }
}

/* Print */
@media print {
    .navbar, footer, .btn, .chat-input {
        display: none !important;
    }
}
