/* ========================================
   Ihram System - Custom Styles
   Arabic RTL Support with Professional Design
   ======================================== */

/* RTL Configuration */
* {
    direction: rtl;
}

html, body {
    font-family: 'Segoe UI', 'Cairo', Tahoma, Arial, sans-serif;
    background-color: var(--light-bg);
    margin: 0;
    padding: 0;
    text-align: right;
}

/* Page Layout */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.sidebar {
    background-color: var(--sidebar-bg) !important;
}

.content {
    padding: 1.5rem;
}

/* Mobile Menu Toggle */
.navbar-toggler {
    display: none;
}

@media (max-width: 640.98px) {
    .navbar-toggler {
        appearance: none;
        cursor: pointer;
        width: 3.5rem;
        height: 3.5rem;
        position: absolute;
        top: 0.5rem;
        left: 0.5rem;
        z-index: 3;
    }

    .sidebar {
        transform: translateX(100%);
    }

    .navbar-toggler:checked ~ .sidebar {
        transform: none;
    }
}

/* Responsive Layout */
@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 270px;
        height: 100vh;
        position: sticky;
        top: 0;
        overflow-y: auto;
    }

    main .top-row {
        position: sticky;
        top: 0;
        z-index: 1;
    }
}

/* Color Palette - Based on Ihram Brand */
:root {
    --primary-color: #b79449; /* Primary Gold */
    --primary-dark: #8a6d35; /* Darker Gold */
    --primary-light: #d4b56d; /* Lighter Gold */
    --secondary-color: #faf6ea; /* Cream/Beige */
    --accent-color: #a67c52; /* Brown accent */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --light-bg: #faf6ea; /* Cream background */
    --dark-text: #2d2416; /* Dark brown text */
    --border-color: #e8dcc8; /* Light brown border */
    --sidebar-bg: #2d2416; /* Dark sidebar */
    --sidebar-hover: #3d3220;
}

/* Main Layout */
.main-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(183, 148, 73, 0.15);
    padding: 2rem;
    margin: 1.5rem;
    border: 1px solid var(--border-color);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid var(--primary-color);
    background: linear-gradient(to right, var(--secondary-color) 0%, white 100%);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

    .page-header h2 {
        color: var(--primary-dark);
        font-weight: 700;
        font-size: 1.8rem;
        margin: 0;
        text-shadow: 1px 1px 2px rgba(183, 148, 73, 0.1);
    }

        .page-header h2 i {
            color: var(--primary-color);
        }

/* Tables */
.table-responsive {
    border-radius: 12px;
    overflow: hidden;
    /*box-shadow: 0 4px 12px rgba(183, 148, 73, 0.12);
    border: 1px solid var(--border-color);*/
}

.table {
    margin-bottom: 0;
}

    .table thead {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
        color: white;
    }

        .table thead th,
        .table-dark th {
            border: none;
            padding: 1.1rem 1rem;
            font-weight: 700;
            text-align: center !important;
            letter-spacing: 0.3px;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
        }

/* تطبيق ألوان الجداول الداكنة */
.table-dark {
    --bs-table-color: #fff;
    --bs-table-bg: #b79449;
    --bs-table-border-color: #8a6d35;
    --bs-table-striped-bg: #a67c52;
    --bs-table-striped-color: #fff;
    --bs-table-active-bg: #8a6d35;
    --bs-table-active-color: #fff;
    --bs-table-hover-bg: #9d7d3f;
    --bs-table-hover-color: #fff;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-dark);
}

    .table tbody tr {
        transition: all 0.3s ease;
        background-color: white;
    }

        .table tbody tr:nth-child(even) {
            background-color: var(--secondary-color);
        }

        .table tbody tr:hover {
            background-color: #f5eed8 !important;
            transform: translateX(-3px);
            box-shadow: 0 2px 8px rgba(183, 148, 73, 0.15);
        }

    .table tbody td {
        padding: 1rem;
        vertical-align: middle;
        border-bottom: 1px solid var(--border-color);
        color: var(--dark-text);
    }

        .table tbody td.prcd {
            width: 1px;
            white-space: nowrap;
        }

.dataTables_filter {
    text-align: end !important;
}

    .dataTables_filter label input {
        margin-right: 5px;
    }

/* Badges */
.badge {
    padding: 0.5rem 1.2rem;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}

    .badge.bg-success {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    }

    .badge.bg-secondary {
        background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%) !important;
    }

/* Modal */
.modal-content {
    border-radius: 20px;
    border: 3px solid var(--primary-color);
    box-shadow: 0 20px 60px rgba(183, 148, 73, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 17px 17px 0 0;
    border: none;
    padding: 1.75rem 2rem;
}

    .modal-header .modal-title {
        font-weight: 700;
        font-size: 1.4rem;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    }

    .modal-header .btn-close {
        margin-left: 0;
        margin-right: auto;
        filter: brightness(0) invert(1);
        opacity: 0.9;
    }

        .modal-header .btn-close:hover {
            opacity: 1;
            transform: scale(1.1);
        }

.modal-body {
    padding: 2.5rem;
    background-color: var(--secondary-color);
}

.modal-footer {
    border-top: 2px solid var(--border-color);
    padding: 1.5rem 2.5rem;
    background-color: white;
}

/* Forms */
.form-label {
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.65rem 1rem;
    transition: all 0.3s ease;
    font-size: 1rem;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.2rem rgba(44, 95, 127, 0.15);
    }

.form-check-input {
    border: 2px solid var(--border-color);
    border-radius: 4px;
    width: 1.3rem;
    height: 1.3rem;
}

    .form-check-input:checked {
        background-color: var(--primary-color);
        border-color: var(--primary-color);
    }

/* Validation */
.invalid-feedback {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.validation-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Loading Spinner */
.spinner-border {
    width: 3.5rem;
    height: 3.5rem;
    border-width: 0.4rem;
    border-color: var(--primary-color);
    border-right-color: transparent;
    box-shadow: 0 0 12px rgba(183, 148, 73, 0.3);
}

/* Alert */
.alert {
    border-radius: 12px;
    border: 2px solid;
    padding: 1.2rem 1.8rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alert-info {
    background: linear-gradient(135deg, #faf6ea 0%, #f5eed8 100%);
    color: var(--primary-dark);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(183, 148, 73, 0.2);
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #10b981;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #ef4444;
}

.alert i {
    font-size: 1.2rem;
    margin-left: 0.5rem;
}

/* Navigation - Sidebar */
.sidebar .top-row {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
    box-shadow: 0 4px 12px rgba(183, 148, 73, 0.3);
    height: 3.5rem;
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

/* Top Bar in Main Content */
main .top-row {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
    box-shadow: 0 2px 8px rgba(183, 148, 73, 0.2);
    border-bottom: 3px solid var(--primary-dark);
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2rem;
}

    main .top-row a {
        color: white !important;
        font-weight: 700;
        font-size: 1.1rem;
        text-decoration: none !important;
        transition: all 0.3s ease;
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    }

        main .top-row a:hover {
            color: var(--secondary-color) !important;
            transform: translateY(-2px);
        }

        main .top-row a i {
            font-size: 1.2rem;
        }

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: white !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-scrollable {
    background-color: var(--sidebar-bg) !important;
}

.nav-item {
    margin: 0.25rem 0.5rem;
}

.nav-link {
    border-radius: 10px;
    padding: 0.85rem 1.2rem !important;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem;
    color: #e8dcc8 !important;
    font-weight: 500;
    border: 2px solid transparent;
}

    .nav-link i {
        font-size: 1.3rem;
        color: var(--primary-color);
        display: flex;
        align-items: center;
        justify-content: center;
        width: 1.5rem;
        height: 1.5rem;
        flex-shrink: 0;
    }

    .nav-link span {
        display: flex;
        align-items: center;
        line-height: 1.5rem;
    }

    .nav-link:hover {
        background-color: var(--sidebar-hover);
        transform: translateX(-5px);
        border-color: var(--primary-color);
        box-shadow: 0 2px 8px rgba(183, 148, 73, 0.2);
    }

    .nav-link.active {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
        font-weight: 700;
        color: white !important;
        box-shadow: 0 4px 12px rgba(183, 148, 73, 0.4);
    }

        .nav-link.active i {
            color: white;
        }

/* Parent Menu (clickable, no navigation) */
.nav-parent {
    cursor: pointer;
    user-select: none;
}

    .nav-parent .ms-auto {
        margin-right: auto;
        margin-left: 0.5rem;
        font-size: 0.9rem;
        transition: transform 0.3s ease;
    }

/* Submenu Level 1 */
.nav-submenu {
    padding-right: 1rem;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    border-right: 3px solid var(--primary-color);
    background-color: rgba(61, 50, 32, 0.3);
}

.nav-sub {
    font-size: 0.95rem;
    padding: 0.65rem 1rem !important;
    margin: 0.15rem 0;
}

    .nav-sub i:first-child {
        font-size: 0.5rem;
        color: var(--primary-light);
    }

/* Submenu Level 2 (nested under land reports) */
.nav-sub-parent {
    cursor: pointer;
    user-select: none;
}

    .nav-sub-parent .small-chevron {
        font-size: 0.75rem;
    }

.nav-submenu-2 {
    padding-right: 1.5rem;
    margin: 0.25rem 0;
    border-right: 2px solid var(--primary-light);
}

.nav-sub-2 {
    font-size: 0.88rem;
    padding: 0.5rem 0.8rem !important;
    margin: 0.1rem 0;
}

    .nav-sub-2 i:first-child {
        font-size: 0.4rem;
        color: var(--primary-color);
    }

    /* Hover effects for submenus */
    .nav-sub:hover,
    .nav-sub-2:hover {
        background-color: rgba(61, 50, 32, 0.5);
        transform: translateX(-3px);
    }

    .nav-sub.active,
    .nav-sub-2.active {
        background: linear-gradient(135deg, rgba(183, 148, 73, 0.9) 0%, rgba(138, 109, 53, 0.9) 100%);
        border-right: 3px solid var(--primary-color);
    }

/* Icons */
.bi {
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
        margin: 0.5rem;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .table {
        font-size: 0.9rem;
    }
}

/* SweetAlert2 RTL Support */
.swal2-popup {
    font-family: 'Segoe UI', 'Cairo', Tahoma, Arial, sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
}

.swal2-title {
    direction: rtl !important;
}

.swal2-content {
    direction: rtl !important;
}

/* SweetAlert2 Toast Style */
.swal2-toast {
    box-shadow: 0 4px 16px rgba(183, 148, 73, 0.3) !important;
    border: 2px solid var(--primary-color) !important;
    border-radius: 12px !important;
}

    .swal2-toast .swal2-title {
        font-weight: 700 !important;
        font-size: 1rem !important;
    }

    .swal2-toast .swal2-icon {
        margin: 0 0.5rem !important;
    }

/* Select2 RTL Support */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    direction: rtl;
    text-align: right;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    min-height: 42px;
}

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        text-align: right;
        padding-right: 1rem;
        padding-left: 2rem;
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        left: 1rem;
        right: auto;
    }

.select2-dropdown {
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    direction: rtl;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-color) !important;
}
