/* Basic RTL admin panel styles - custom lightweight framework */

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
    direction: rtl;
    background: #f5f6fa;
    color: #222;
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 230px;
    background: #111827;
    color: #e5e7eb;
    padding: 1rem 0.75rem;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: right;
}

.sidebar a {
    display: block;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: #d1d5db;
    text-decoration: none;
    border-radius: 0.25rem;
}

.sidebar a:hover,
.sidebar a.active {
    background: #1f2937;
    color: #fff;
}

.main {
    flex: 1;
    padding: 1.5rem;
}

/* Top bar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.topbar-title {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Bootstrap‑like utility classes (minimal) */

.container {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.5rem;
    margin-left: -0.5rem;
}

[class^="col-"],
[class*=" col-"] {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

/* simple grid: col-12 / col-md-4 / col-md-6 / col-md-3 */
.col-12 { flex: 0 0 100%; max-width: 100%; }

.col-md-3, .col-md-4, .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.3333%; max-width: 33.3333%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
}

/* Cards */

.card {
    background: #ffffff;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    background: #f9fafb;
}

.card-body {
    padding: 1rem;
}

/* Buttons */

.btn {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-danger {
    background: #dc2626;
    border-color: #b91c1c;
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: #6b7280;
    border-color: #4b5563;
    color: #fff;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Forms */

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.form-control, .form-select, textarea.form-control {
    display: block;
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.9rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
    background-color: #fff;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

/* Tables */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table thead {
    background: #f3f4f6;
}

.table th,
.table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: right;
}

.table-striped tbody tr:nth-child(odd) {
    background: #fafafa;
}

/* Alerts */

.alert {
    padding: 0.6rem 0.9rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Dashboard chart container */

.chart-card {
    height: 260px;
}

/* Mobile layout */

@media (max-width: 768px) {
    .wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        display: none;
    }

    .sidebar.open {
        display: block;
    }

    .main {
        padding: 1rem;
    }

    .mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 999px;
        border: none;
        background: #111827;
        color: #f9fafb;
        cursor: pointer;
        margin-left: 0.5rem;
    }
}

@media (min-width: 769px) {
    .mobile-toggle {
        display: none;
    }
}