:root {
    --bg-color: #0f172a;
    /* Slate 900 - Darker, richer background */
    --card-bg: #1e293b;
    /* Slate 800 - Slightly lighter card */
    --text-color: #f8fafc;
    /* Slate 50 - Whiteish text */
    --text-muted: #94a3b8;
    /* Slate 400 - Muted text */
    --primary: #3b82f6;
    /* Blue 500 - Primary Actions */
    --secondary: #475569;
    /* Slate 600 - Secondary Actions */
    --accent: #8b5cf6;
    /* Violet 500 - Brand Accent */
    --success: #10b981;
    /* Emerald 500 */
    --danger: #ef4444;
    /* Red 500 */
    --warning: #f59e0b;
    /* Amber 500 */
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 0;
    direction: rtl;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

/* Navbar */
.navbar {
    background-color: var(--card-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid #334155;
    margin-bottom: 30px;
}

.brand {
    color: var(--primary);
    font-weight: 800;
    font-size: 1.5rem;
    text-decoration: none;
    background: linear-gradient(to right, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid #334155;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card h3 {
    margin-top: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    color: white;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(110%);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    background-color: var(--secondary);
    color: #e2e8f0;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.5);
}

/* Forms */
input,
select,
textarea {
    background-color: #0f172a;
    border: 1px solid #334155;
    color: white;
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 15px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

button[type="submit"] {
    cursor: pointer;
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 16px;
    text-align: right;
    border-bottom: 1px solid #334155;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

/* Alerts */
.alert {
    padding: 16px;
    margin-bottom: 24px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 500;
}

.alert-error,
.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.2);
}

/* Utilities */
hr {
    border: 0;
    border-top: 1px solid #334155;
    margin: 20px 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        width: 100%;
    }

    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 1rem;
        text-align: center;
    }

    .navbar>div {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .navbar a.btn {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        margin: 0 !important;
    }

    .card {
        padding: 15px;
    }

    /* Stack grid forms on mobile */
    form[style*="grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Adjust Action Buttons in Index */
    /* Adjust Action Buttons in Index */
    .card .btn {
        width: 100%;
        margin-bottom: 10px;
        justify-content: center;
        box-sizing: border-box;
    }

    /* Reset button width in Tables */
    .card table .btn {
        width: auto !important;
        margin-bottom: 0;
        padding: 5px 10px;
    }

    /* Fix Badges */
    .card table span {
        white-space: nowrap;
        display: inline-block;
    }

    .card div[style*="flex"] {
        flex-direction: column;
    }

    /* Ensure tables scroll */
    .table-container,
    div[style*="overflow-x"] {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Modal adjustments */
    .modal-content {
        width: 90%;
        margin: 20% auto;
        padding: 20px;
    }

    /* Fix Pagination on mobile */
    .pagination-container .btn {
        width: auto !important;
        margin-bottom: 0 !important;
    }
}