@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;600;700;800&display=swap');

:root {
    --font-sans: "Tajawal", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    --color-bg: #f3f5f9;
    --color-surface: #ffffff;
    --color-text: #0f172a;
    --color-muted: #000000;
    --color-border: #e2e8f0;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #60a5fa;
    --color-accent: #0ea5e9;
    --color-danger: #ef4444;
    --color-success: #10b981;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 30px 70px rgba(15, 23, 42, 0.18);
}

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

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: radial-gradient(circle at top right, rgba(14,165,233,0.18), transparent 45%), var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    direction: rtl;
}

a {
    color: inherit;
}

.print-only-black {
    color: #000 !important;
}

@media print {
    * {
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    a {
        text-decoration: none !important;
    }
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: linear-gradient(120deg, rgba(15,23,42,0.95), rgba(37,99,235,0.95));
    color: #fff;
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.22);
}

.app-header__brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-header__logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(14,165,233,0.7));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.app-header__title {
    font-size: 1.2rem;
    font-weight: 700;
}

.app-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.app-nav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
}

.app-nav__link:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.app-nav__link--active {
    background: #fff;
    color: var(--color-primary-dark);
    box-shadow: 0 8px 18px rgba(255,255,255,0.35);
}

.app-header__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    padding: 10px 18px;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.25);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(120deg, var(--color-primary), var(--color-accent));
    color: #fff;
    box-shadow: 0 12px 28px rgba(37,99,235,0.28);
}

.btn-secondary {
    background: #fff;
    color: var(--color-primary-dark);
    box-shadow: inset 0 0 0 2px rgba(37,99,235,0.18);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    box-shadow: 0 12px 28px rgba(239, 68, 68, 0.28);
}

.btn-ghost {
    background: transparent;
    color: inherit;
    box-shadow: none;
    border: 1px solid rgba(255,255,255,0.4);
}

.app-main {
    flex: 1;
    padding: 36px 32px 64px;
}

.app-container {
    max-width: 1180px;
    margin: 0 auto;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 10px;
}

.page-subtitle {
    margin: 0 0 26px;
    color: var(--color-muted);
    font-size: 1rem;
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-weight: 600;
}

.alert-info {
    background: rgba(14,165,233,0.12);
    color: #0369a1;
}

.alert-success {
    background: rgba(16,185,129,0.12);
    color: #047857;
}

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 28px 32px;
    margin-bottom: 28px;
}

.card--flat {
    box-shadow: none;
    border: 1px solid rgba(226,232,240,0.8);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.card-title {
    margin: 0;
    font-size: 1.4rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table thead {
    background: linear-gradient(120deg, rgba(37,99,235,0.95), rgba(14,165,233,0.95));
    color: #fff;
}

.table th,
.table td {
    padding: 14px 18px;
    text-align: right;
}

.table tbody tr {
    background: #fff;
}

.table tbody tr:nth-child(even) {
    background: rgba(241,245,249,0.7);
}

.table tbody tr:hover {
    background: rgba(191, 219, 254, 0.35);
}

.table td,
.table th {
    border-bottom: 1px solid var(--color-border);
}

.table td.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.muted {
    color: var(--color-muted);
}

.form {
    display: grid;
    gap: 20px;
}

.form-grid {
    display: grid;
    gap: 20px;
}

.form-grid--two {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-label {
    font-weight: 600;
    color: var(--color-muted);
    margin-bottom: 6px;
}

.form-control,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148,163,184,0.4);
    background: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}

.form-textarea {
    min-height: 110px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    background: rgba(37,99,235,0.12);
    color: var(--color-primary-dark);
    font-weight: 600;
}

.empty-state {
    padding: 32px 24px;
    text-align: center;
    color: var(--color-muted);
    font-weight: 600;
}

.pagination {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.pagination--centered {
    justify-content: center;
}

.pagination-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(226,232,240,0.9);
    background: #fff;
    box-shadow: 0 12px 30px rgba(15,23,42,0.08);
}

.pagination-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--color-text);
}

.pagination-links {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.page-link {
    min-width: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(226,232,240,0.9);
    background: #fff;
    color: var(--color-text);
    text-decoration: none;
    text-align: center;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65);
    transition: all 0.15s ease;
}

.page-link:hover {
    border-color: rgba(37,99,235,0.35);
    color: var(--color-primary-dark);
    transform: translateY(-1px);
}

.page-link.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(37,99,235,0.22);
}

.page-link.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .pagination-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .pagination-links {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 900px) {
    .app-header {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
    .app-header__brand {
        justify-content: center;
    }
    .app-main {
        padding: 28px 20px 48px;
    }
    .card {
        padding: 22px 20px;
    }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .table thead {
        display: none;
    }
    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }
    .table tr {
        margin-bottom: 16px;
        border-radius: var(--radius-md);
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    }
    .table td {
        text-align: left;
        padding-inline: 16px;
        border-bottom: 1px solid rgba(226,232,240,0.6);
    }
    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-muted);
        display: block;
        margin-bottom: 4px;
    }
    .table td.actions {
        justify-content: flex-start;
    }
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: radial-gradient(circle at 20% 20%, rgba(14,165,233,0.18), transparent 45%), var(--color-bg);
}

.auth-card {
    width: min(460px, 100%);
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 44px;
}

.auth-card h1 {
    margin: 0 0 10px;
    font-size: 1.8rem;
    color: var(--color-text);
}

.auth-card p {
    margin: 0 0 24px;
    color: var(--color-muted);
}

.auth-card .btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

.auth-meta {
    margin-top: 18px;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.95rem;
}
