:root {
    --primary-color: #111111;
    --secondary-color: #555555;
    --accent-color: #c8a255;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #dddddd;
    --danger-color: #c0392b;

    --header-bg: #111111;
    --footer-bg: #111111;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    direction: rtl;
    background-color: var(--bg-color);
    color: var(--primary-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 16px; /* أكبر شوية من الافتراضي */
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ================= HEADER ================= */

.layout-header {
    background-color: var(--header-bg);
    color: #ffffff;
    padding: 10px 22px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.layout-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* يسار – وسط (اللوجو) – يمين */
    align-items: center;
    gap: 16px;
}

.header-section {
    display: flex;
    align-items: center;
}

/* يسار الهيدر: العودة + اللغة */
.header-left {
    justify-self: flex-start;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-main-link a {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-color);
    white-space: nowrap;
}

/* وسط الهيدر: اللوجو */
.header-center {
    justify-self: center;
}

.header-center img.logo {
    height: 90px;          /* تكبير اللوجو */
    width: auto;
    display: block;
}

/* يمين الهيدر: فاضي حالياً للاتزان */
.header-right {
    justify-self: flex-end;
}

/* أزرار اللغة */
.header-lang {
    display: flex;
    gap: 6px;
}

.lang-btn {
    border-radius: 999px;
    border: 1px solid #777;
    padding: 4px 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #ffffff;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.lang-btn:hover {
    background-color: #333333;
}

.lang-btn.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
}

/* ================= CONTENT ================= */

.app-container {
    max-width: 960px;
    margin: 30px auto 40px;
    padding: 0 15px;
    flex: 1 0 auto;
    width: 100%;
}

/* الصفحة الرئيسية: الكارت في المنتصف تقريبا */
.home-page {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 50px 15px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    padding: 28px 26px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

h1, h2, h3, h4 {
    margin-top: 0;
    color: var(--primary-color);
    font-weight: 800;
}

h1 {
    font-size: 26px;
}

h2 {
    font-size: 22px;
}

.text-muted {
    color: var(--secondary-color);
    font-size: 15px;
}

.text-center {
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 16px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 9px 11px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 16px;
    background-color: #ffffff;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(200,162,85,0.25);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button,
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.2s ease;
}

button:active,
.btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.btn-primary {
    background-color: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.btn-primary:hover {
    background-color: #a17f33;
}

.btn-secondary {
    background-color: #eeeeee;
    color: var(--primary-color);
}

.btn-secondary:hover {
    background-color: #dddddd;
}

.btn-danger {
    background-color: var(--danger-color);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #962d22;
}

.alert {
    padding: 11px 13px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 15px;
}

.alert-error {
    background-color: #fdecea;
    color: var(--danger-color);
}

.alert-success {
    background-color: #e8f8f2;
    color: #1e8449;
}

.alert-info {
    background-color: #eaf2fb;
    color: #1f4e79;
}

.field-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.field-inline .form-group {
    flex: 1 1 220px;
}

.home-hero {
    text-align: center;
    padding: 26px 24px;
    max-width: 650px;
    margin: 0 auto;
}

.home-hero p {
    margin-bottom: 26px;
}

.home-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
}

.home-actions .btn {
    min-width: 230px;
}

/* ================= FOOTER ================= */

.layout-footer {
    text-align: center;
    padding: 18px 15px;
    font-size: 14px;
    color: #f0f0f0;
    background-color: var(--footer-bg);
    border-top: 1px solid #222;
    margin-top: 40px;
    flex-shrink: 0;
}

.layout-footer .footer-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.layout-footer .footer-inner div {
    margin: 2px 0;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 800px) {
    .layout-header-inner {
        grid-template-columns: 1fr;
        row-gap: 8px;
        justify-items: center;
        text-align: center;
    }

    .header-left {
        flex-direction: column;
        justify-self: center;
    }

    .header-right {
        display: none;
    }

    .home-page {
        padding-top: 30px;
        padding-bottom: 30px;
    }

    .home-actions {
        flex-direction: column;
    }

    .home-actions .btn {
        width: 100%;
    }
}

/* ===== تخطيط عام للوحة الإدارة الجديدة ===== */

body.admin-layout {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f7fb;
}

.admin-shell {
    display: flex;
    flex-direction: row-reverse; /* علشان السايدبار يبقى يمين */
    min-height: 100vh;
}

/* ===== السايدبار ===== */

.admin-sidebar {
    width: 240px;
    background: linear-gradient(180deg, #1f4e79 0%, #0b2740 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    box-shadow: -2px 0 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    text-align: center;
    margin-bottom: 16px;
}
.sidebar-logo img {
    max-width: 140px;
    height: auto;
}

.sidebar-user {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 18px;
    text-align: center;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    padding-right: 2px;
}

.sidebar-link {
    display: block;
    padding: 10px 12px;
    border-radius: 999px;
    font-size: 14px;
    text-decoration: none;
    color: #e5ecf5;
    background: transparent;
    border: 1px solid transparent;
    transition: background 0.2s, color 0.2s, transform 0.1s, box-shadow 0.1s;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.18);
    transform: translateY(-1px);
}
.sidebar-link.active {
    background: #ffffff;
    color: #1f4e79;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
    border-color: rgba(255,255,255,0.4);
}

.sidebar-footer {
    margin-top: 12px;
    font-size: 12px;
    opacity: 0.85;
    text-align: center;
}
.sidebar-footer a {
    color: #dbeafe;
    text-decoration: underline;
}

/* ===== منطقة المحتوى ===== */

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 22px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.admin-topbar-left,
.admin-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-topbar a.main-site-link {
    font-size: 13px;
    text-decoration: none;
    color: #1f4e79;
}
.admin-topbar a.main-site-link:hover {
    text-decoration: underline;
}

.admin-topbar .logout-btn {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 999px;
}

/* الحاوية الداخلية للمحتوى */
.admin-content {
    padding: 20px 22px 30px;
}

/* ===== كروت الداشبورد ===== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.dashboard-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 4px 14px rgba(15,23,42,0.06);
    border: 1px solid #e5e7eb;
}

.dashboard-card h3 {
    margin: 0 0 4px;
    font-size: 14px;
    color: #4b5563;
}

.dashboard-card .value {
    font-size: 26px;
    font-weight: 800;
    margin: 4px 0;
    color: #111827;
}

.dashboard-card .hint {
    font-size: 12px;
    color: #6b7280;
}

/* مربع الملاحظات */
.team-notes {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 4px 14px rgba(15,23,42,0.06);
    border: 1px solid #e5e7eb;
    margin-top: 18px;
}

.team-notes-list {
    max-height: 260px;
    overflow-y: auto;
    margin-top: 10px;
    border-top: 1px dashed #e5e7eb;
    padding-top: 8px;
}
.team-note-item {
    padding: 6px 0;
    border-bottom: 1px dashed #f3f4f6;
}
.team-note-meta {
    font-size: 11px;
    color: #6b7280;
}
.team-note-text {
    font-size: 13px;
    margin-top: 3px;
}

/* أزرار صغيرة */
.btn-pill {
    border-radius: 999px !important;
}

/* استجابة للموبايل */
@media (max-width: 768px) {
    .admin-shell {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: column;
    }
}
