/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #006C35;
    --primary-dark: #004d24;
    --primary-light: #e8f5ee;
    --accent: #C9A227;
    --bg: #f7f9fc;
    --card: #ffffff;
    --text: #1a2332;
    --text-muted: #6b7888;
    --border: #e4e9f0;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== Header ===== */
.main-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary);
}

.logo-icon {
    font-size: 1.5rem;
}

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

.main-nav a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
    transition: var(--transition);
}

.main-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 32px 0;
}

.page-header {
    text-align: center;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--primary);
    font-weight: 500;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-muted);
}

/* ===== Cards Grid ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 4px;
}

.card-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card.completed {
    opacity: 0.5;
    background: #f0f0f0;
}

.card.completed::after {
    content: '✓ مكتمل';
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--success);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== Categories Section ===== */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary);
    border-radius: 2px;
}

/* ===== Detail Page ===== */
.detail-page {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.info-box {
    background: var(--primary-light);
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.info-box-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.info-box-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    word-break: break-word;
}

.info-box-value.large {
    font-size: 2rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary-light);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

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

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

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: white;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 108, 53, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 200px;
    line-height: 1.7;
}

/* ===== Alerts ===== */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--primary);
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ===== Dashboard ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    margin-top: 16px;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-sidebar {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    height: fit-content;
    position: sticky;
    top: 90px;
}

.dashboard-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    color: var(--text);
    font-weight: 500;
    transition: var(--transition);
}

.dashboard-sidebar a:hover,
.dashboard-sidebar a.active {
    background: var(--primary);
    color: white;
}

.dashboard-content {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card.accent {
    background: linear-gradient(135deg, var(--accent), #b8911f);
}

.stat-card.success {
    background: linear-gradient(135deg, var(--success), #15803d);
}

.stat-card.danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
}

/* ===== Tables ===== */
.table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

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

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.data-table tr:hover {
    background: #fafbfc;
}

.data-table td {
    font-size: 0.95rem;
}

.url-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
    text-align: left;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* ===== Map Link Card ===== */
.maps-cta {
    background: linear-gradient(135deg, #4285F4, #34A853);
    color: white;
    padding: 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.maps-cta-text h3 {
    margin-bottom: 4px;
}

.maps-cta-text p {
    opacity: 0.9;
    font-size: 0.95rem;
}

.maps-cta .btn {
    background: white;
    color: #4285F4;
    font-weight: 700;
}

.maps-cta .btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

/* ===== Counter Display ===== */
.counter-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.counter-display .count {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.counter-display .label {
    color: var(--text-muted);
}

/* ===== Search Box ===== */
.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    padding: 12px 44px 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
}

/* ===== Footer ===== */
.main-footer {
    background: var(--text);
    color: white;
    padding: 24px 0;
    text-align: center;
    margin-top: auto;
}

.main-footer p {
    opacity: 0.8;
    font-size: 0.9rem;
}

/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 48px 0;
    border-radius: var(--radius);
    margin-bottom: 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 1px, transparent 1px),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 40px 40px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.hero p {
    font-size: 1.15rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== List Items ===== */
.item-list {
    list-style: none;
}

.list-item {
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.list-item-text {
    font-weight: 600;
    flex: 1;
    min-width: 200px;
}

.list-item-actions {
    display: flex;
    gap: 6px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    .hero p {
        font-size: 1rem;
    }
    .page-header h1 {
        font-size: 1.5rem;
    }
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    .card {
        padding: 14px;
    }
    .card-title {
        font-size: 0.95rem;
    }
    .detail-page {
        padding: 20px;
    }
    .login-card {
        padding: 24px;
    }
    .main-header .container {
        flex-direction: column;
    }
    .main-nav {
        justify-content: center;
    }
    .stat-value {
        font-size: 1.5rem;
    }
    .maps-cta {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .info-grid {
        grid-template-columns: 1fr 1fr;
    }
    .info-box-value.large {
        font-size: 1.5rem;
    }
}

/* ===== Loading & Empty States ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state-text {
    font-size: 1rem;
}

/* ===== Helpers ===== */
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.mt-3 { margin-top: 24px; }
.mb-3 { margin-bottom: 24px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.gap-2 { gap: 12px; }
