:root {
    --primary-color: #007bff;
    --sidebar-width: 250px;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
}

.wrapper {
    display: flex;
    width: 100%;
}

/* السايدبار */
#sidebar {
    width: 250px;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 999;
    background: #343a40;
    color: #fff;
    transition: all 0.3s;
}

#sidebar .sidebar-header {
    padding: 20px;
    background: #2c3136;
    text-align: center;
}

#sidebar ul.components {
    padding: 20px 0;
    border-bottom: 1px solid #47494c;
}

#sidebar ul li {
    border-bottom: 1px solid #47494c;
}

#sidebar ul li:last-child {
    border-bottom: none;
}

#sidebar ul li a {
    padding: 15px 20px;
    font-size: 1.1em;
    display: block;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s;
}

#sidebar ul li a:hover,
#sidebar ul li a.active {
    color: #fff;
    background: #007bff;
}

#sidebar ul li.active > a {
    color: #fff;
    background: #007bff;
}

/* المحتوى الرئيسي */
#content {
    width: calc(100% - 250px);
    margin-right: 250px;
    min-height: 100vh;
    transition: all 0.3s;
    position: relative;
    background: #f4f6f9;
    padding: 20px;
}

/* LTR Layout Support */
html[dir="ltr"] #content {
    margin-right: 0;
    margin-left: 280px;
}

html[dir="ltr"] #sidebar {
    right: auto;
    left: 0;
}

/* POS Page - Auto Hide Sidebar */
body.pos-page #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

body.pos-page.rtl #sidebar {
    transform: translateX(100%);
}

body.pos-page #content {
    margin-right: 0;
    margin-left: 0;
    width: 100%;
    transition: all 0.3s ease;
}

/* Show sidebar toggle button on POS page */
body.pos-page .sidebar-toggle-btn {
    display: block;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

body.pos-page.rtl .sidebar-toggle-btn {
    left: auto;
    right: 20px;
}

body.pos-page .sidebar-toggle-btn:hover {
    background: #0056b3;
    transform: scale(1.05);
}

/* When sidebar is shown on POS page */
body.pos-page.sidebar-visible #sidebar {
    transform: translateX(0);
}

body.pos-page.sidebar-visible #content {
    margin-right: 280px;
}

body.pos-page.sidebar-visible.rtl #content {
    margin-right: 0;
    margin-left: 280px;
}

/* زر التبديل */
#sidebarCollapse {
    display: none;
}

/* تعديلات السايدبار للشاشات الصغيرة */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        position: relative;
    }

    body.sidebar-active {
        overflow: hidden;
    }

    #sidebarCollapse {
        display: block;
    }

    #sidebar {
        margin-right: -250px;
        box-shadow: none;
    }

    #sidebar.active {
        margin-right: 0;
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
    }

    /* LTR mobile layout */
    html[dir="ltr"] #sidebar {
        margin-right: 0;
        margin-left: -280px;
        left: 0;
        right: auto;
    }

    html[dir="ltr"] #sidebar.active {
        margin-left: 0;
    }

    #content {
        width: 100%;
        margin-right: 0;
        padding: 15px;
        transition: transform 0.3s ease-in-out;
    }

    html[dir="ltr"] #content {
        margin-left: 0;
    }

    body.sidebar-active #content {
        transform: translateX(-250px);
    }

    html[dir="ltr"] body.sidebar-active #content {
        transform: translateX(250px);
    }

    .overlay {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.7);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s ease-in-out;
    }

    .overlay.active {
        display: block;
        opacity: 1;
    }

    /* تحسين مظهر السايدبار في الموبايل */
    #sidebar .sidebar-header {
        padding: 15px;
        border-bottom: 1px solid #47494c;
    }

    #sidebar ul.components {
        padding: 10px 0;
    }

    #sidebar ul li a {
        padding: 12px 20px;
        font-size: 16px;
    }

    #sidebar ul li a i {
        width: 24px;
        text-align: center;
        margin-left: 8px;
    }
}

/* تنسيق عام */
.nav-link i {
    margin-left: 10px;
    width: 20px;
    text-align: center;
}

.card {
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 15px;
}

.table th {
    background-color: #f8f9fa;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

.card-body {
    padding: 20px;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
}

/* تنسيق أزرار الإجراءات في الجداول */
.btn-whatsapp {
    background-color: #25d366;
    color: #fff;
}

.btn-whatsapp:hover {
    background-color: #128c7e;
    color: #fff;
}

.table .btn-group {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.table .btn-group .btn {
    margin: 2px;
    white-space: nowrap;
}

/* جداول متجاوبة للموبايل */
@media (max-width: 767.98px) {
    .table-responsive-stack thead {
        display: none;
    }
    
    .table-responsive-stack tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
    }
    
    .table-responsive-stack td {
        display: block;
        text-align: right;
        padding: 0.75rem;
        border: none;
        position: relative;
        padding-right: 50%;
        white-space: normal;
    }
    
    .table-responsive-stack td:before {
        content: attr(data-label);
        position: absolute;
        right: 0;
        width: 45%;
        padding-right: 0.75rem;
        font-weight: bold;
        text-align: right;
    }
    
    .table-responsive-stack td:not(:last-child) {
        border-bottom: 1px solid #dee2e6;
    }
    
    .table-responsive-stack .btn-group {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .table-responsive-stack .btn-group .btn {
        width: 100%;
        margin: 0;
    }
    
    .table-responsive-stack .badge {
        display: inline-block;
        margin: 0 auto;
    }
}

/* Custom Buttons */
.btn-info {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-info:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

/* Stats Cards */
.card .display-6 {
    font-size: 2rem;
    font-weight: 500;
}

/* Navbar */
.navbar {
    padding: 15px;
    background: white !important;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

/* أزرار التحكم */
.btn-toggle-sidebar {
    display: none;
}

@media (max-width: 768px) {
    .btn-toggle-sidebar {
        display: block;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
        width: 45px;
        height: 45px;
        border-radius: 50%;
        background: #0d6efd;
        color: white;
        border: none;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }
}

/* تنسيق بطاقات الحجوزات */
.booking-card {
    transition: all 0.3s ease;
    height: 100%;
}

.booking-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.booking-card .card-header {
    padding: 1rem;
}

.booking-card .badge {
    font-size: 0.9rem;
}

.booking-card .card-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.booking-card .card-text {
    margin-bottom: 0.5rem;
}

.booking-card .card-text i {
    width: 20px;
    text-align: center;
    margin-left: 8px;
}

.booking-card .btn {
    margin-bottom: 0.5rem;
}

.booking-card .btn i {
    margin-left: 8px;
}

.booking-card.border-warning {
    border-width: 2px;
}

.booking-card.border-info {
    border-width: 2px;
}
