:root {
    --crawd-primary: #1a56db;
    --crawd-secondary: #7e3af2;
    --crawd-accent: #ff6b00;
    --crawd-dark: #111827;
    --crawd-light: #f9fafb;
    --crawd-success: #057a55;
    --crawd-warning: #d97706;
}

* { box-sizing: border-box; }

html, body {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    direction: rtl;
    background-color: #f9fafb;
    color: #374151;
}

/* Loading */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: var(--crawd-primary);
}

/* Navbar */
.crawd-navbar {
    background: #fff;
    box-shadow: 0 1px 8px rgba(0,0,0,0.07);
    padding: 0.8rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.crawd-navbar .navbar-brand {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--crawd-primary);
    text-decoration: none;
}

.crawd-navbar .brand-accent {
    color: var(--crawd-accent);
}

.crawd-navbar .nav-link {
    color: #374151;
    font-size: 0.95rem;
    padding: 0.5rem 0.8rem;
    transition: color 0.2s;
}

.crawd-navbar .nav-link:hover,
.crawd-navbar .nav-link.active {
    color: var(--crawd-primary);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #1a56db 0%, #7e3af2 100%);
    color: white;
    padding: 5rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
    pointer-events: none;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1.2rem;
}

.hero-subtitle {
    font-size: 1.15rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    line-height: 1.7;
}

/* Stats */
.stats-section {
    background: white;
    padding: 2.5rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.stat-item {
    text-align: center;
    padding: 1rem;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--crawd-primary);
    display: block;
}

.stat-label {
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

/* Section */
.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--crawd-dark);
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: #6b7280;
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

/* Project Card */
.project-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.project-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #e0e7ff, #ede9fe);
}

.project-card-img-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #e0e7ff, #ede9fe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--crawd-primary);
}

.project-card-body {
    padding: 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--crawd-dark);
    margin-bottom: 0.4rem;
}

.project-card-company {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.8rem;
}

.progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e5e7eb;
    margin-bottom: 0.8rem;
}

.progress-bar {
    border-radius: 4px;
    background: linear-gradient(90deg, var(--crawd-primary), var(--crawd-secondary));
}

.project-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.project-meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.project-meta-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--crawd-dark);
}

.project-meta-label {
    font-size: 0.75rem;
    color: #9ca3af;
}

.project-status-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-weight: 500;
}

/* Auth pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff, #f5f3ff);
    padding: 2rem;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 460px;
}

.auth-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--crawd-primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

/* Profile */
.profile-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 1.5rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--crawd-primary), var(--crawd-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    font-weight: 700;
}

/* Footer */
.crawd-footer {
    background: var(--crawd-dark);
    color: #9ca3af;
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.crawd-footer h5 {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.crawd-footer a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.4rem;
    transition: color 0.2s;
}

.crawd-footer a:hover {
    color: white;
}

.footer-divider {
    border-top: 1px solid #374151;
    margin: 1.5rem 0;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

/* FAQ */
.faq-item {
    background: white;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.faq-question {
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.faq-question:hover { background: #f9fafb; }

.faq-answer {
    padding: 0 1.25rem 1rem;
    color: #6b7280;
    line-height: 1.7;
    border-top: 1px solid #f3f4f6;
}

/* Utility */
.btn-primary {
    background: var(--crawd-primary);
    border-color: var(--crawd-primary);
    font-weight: 500;
    padding: 0.6rem 1.5rem;
}

.btn-primary:hover {
    background: #1645b4;
    border-color: #1645b4;
}

.btn-outline-primary {
    border-color: var(--crawd-primary);
    color: var(--crawd-primary);
}

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

.text-primary { color: var(--crawd-primary) !important; }

.badge-active { background-color: #dcfce7; color: #166534; }
.badge-funded { background-color: #dbeafe; color: #1e40af; }
.badge-settled { background-color: #f3f4f6; color: #6b7280; }

#blazor-error-ui {
    color-scheme: light only;
    background: #fef2f2;
    border-top: 2px solid #fee2e2;
    color: #991b1b;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 9999;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 768px) {
    .hero-title { font-size: 1.8rem; }
    .stat-number { font-size: 1.6rem; }
}

/* =========================================================
   Admin Panel (پنل ادمین)
   ========================================================= */
.admin-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--crawd-dark);
}

.admin-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #eef1f6;
}

.admin-topbar {
    background: linear-gradient(90deg, var(--crawd-primary), var(--crawd-secondary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.admin-topbar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.admin-topbar-link {
    color: #fff;
    text-decoration: none;
    background: rgba(255,255,255,0.12);
    border: none;
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background 0.2s;
    cursor: pointer;
}

.admin-topbar-link:hover { background: rgba(255,255,255,0.25); color: #fff; }
.admin-topbar-link.btn-logout:hover { background: var(--crawd-accent); }

.admin-burger {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    margin-left: 0.5rem;
    cursor: pointer;
}

.admin-body {
    display: flex;
    flex: 1;
    align-items: stretch;
}

.admin-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--crawd-dark);
    color: #cbd5e1;
    padding: 1rem 0.75rem 2rem;
    overflow-y: auto;
}

.admin-nav-group { margin-bottom: 1.25rem; }

.admin-nav-group-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.75rem;
    margin-bottom: 0.4rem;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #cbd5e1;
    text-decoration: none;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
    transition: background 0.15s, color 0.15s;
}

.admin-nav-link i { width: 18px; text-align: center; font-size: 0.95rem; }
.admin-nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.admin-nav-link.active {
    background: linear-gradient(90deg, var(--crawd-primary), var(--crawd-secondary));
    color: #fff;
    font-weight: 600;
}

.admin-main {
    flex: 1;
    padding: 1.5rem;
    min-width: 0;
    overflow-x: auto;
}

/* List view */
.admin-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--crawd-dark);
    margin-bottom: 1.25rem;
}

.admin-layout-cols { display: flex; gap: 1.25rem; align-items: flex-start; }
.admin-content-col { flex: 1; min-width: 0; }

.admin-filter-col {
    width: 220px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    align-self: flex-start;
}

.admin-filter-header {
    background: var(--crawd-primary);
    color: #fff;
    font-weight: 700;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

.admin-filter-section { padding: 0.5rem 1rem 0.75rem; border-bottom: 1px solid #f1f5f9; }
.admin-filter-section:last-child { border-bottom: none; }
.admin-filter-section-title { font-size: 0.8rem; color: #64748b; font-weight: 700; margin-bottom: 0.4rem; }
.admin-filter-link {
    display: block;
    padding: 0.2rem 0;
    font-size: 0.85rem;
    color: #475569;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    text-align: right;
    width: 100%;
}
.admin-filter-link:hover { color: var(--crawd-primary); }
.admin-filter-link.active { color: var(--crawd-primary); font-weight: 700; }

.admin-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.admin-table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 0.6rem 0.75rem;
    text-align: right;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
.admin-table tbody td { padding: 0.55rem 0.75rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.admin-table tbody tr:hover { background: #f8fafc; }
.admin-table a { color: var(--crawd-primary); text-decoration: none; }
.admin-table a:hover { text-decoration: underline; }

.admin-empty { text-align: center; color: #94a3b8; padding: 2.5rem 1rem; }

.admin-pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.admin-pagination .pages { display: flex; gap: 0.25rem; }
.admin-pagination button {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    font-size: 0.85rem;
}
.admin-pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.admin-pagination button.active { background: var(--crawd-primary); color: #fff; border-color: var(--crawd-primary); }

/* Dashboard */
.admin-stat-group { margin-bottom: 1.5rem; }
.admin-stat-group-title {
    background: var(--crawd-primary);
    color: #fff;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 8px 8px 0 0;
    font-size: 0.95rem;
}
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.85rem;
    background: #fff;
    padding: 1rem;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.admin-stat-card {
    border-right: 4px solid var(--crawd-primary);
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.85rem 1rem;
}
.admin-stat-card .value { font-size: 1.5rem; font-weight: 700; color: var(--crawd-dark); }
.admin-stat-card .label { font-size: 0.8rem; color: #64748b; }
.admin-stat-card.green { border-right-color: var(--crawd-success); }
.admin-stat-card.green .value { color: var(--crawd-success); }
.admin-stat-card.orange { border-right-color: var(--crawd-accent); }
.admin-stat-card.orange .value { color: var(--crawd-accent); }
.admin-stat-card.red { border-right-color: #dc2626; }
.admin-stat-card.red .value { color: #dc2626; }
.admin-stat-card.purple { border-right-color: var(--crawd-secondary); }
.admin-stat-card.purple .value { color: var(--crawd-secondary); }

/* Detail / edit form */
.admin-fieldset { background: #fff; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 1.25rem; overflow: hidden; }
.admin-fieldset-title { background: var(--crawd-primary); color: #fff; font-weight: 700; padding: 0.55rem 1rem; font-size: 0.92rem; }
.admin-fieldset-body { padding: 1rem 1.25rem; }
.admin-field-row { display: flex; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px dashed #f1f5f9; }
.admin-field-row:last-child { border-bottom: none; }
.admin-field-label { width: 200px; flex-shrink: 0; color: #64748b; font-size: 0.85rem; }
.admin-field-value { flex: 1; color: #1e293b; font-size: 0.9rem; word-break: break-word; }

@media (max-width: 992px) {
    .admin-filter-col { display: none; }
}

@media (max-width: 768px) {
    .admin-burger { display: inline-block; }
    .admin-sidebar {
        position: fixed;
        top: 56px;
        right: 0;
        bottom: 0;
        z-index: 1040;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        box-shadow: -4px 0 16px rgba(0,0,0,0.2);
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { padding: 1rem; }
}

/* Profile detail modal (no Bootstrap JS dependency) */
.profile-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1060;
    padding: 2rem 1rem;
    overflow-y: auto;
}

.profile-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.25);
    animation: profileModalIn 0.18s ease;
}

@keyframes profileModalIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eef1f6;
    font-weight: 700;
    color: var(--crawd-dark);
}

.btn-close-modal {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}

.btn-close-modal:hover { color: var(--crawd-accent); }

.profile-modal-body { padding: 1.25rem; }
