/* === HI Clients Portal — Design System === */
/* Matches hamdouchi.com color scheme */

:root {
    --primary: #1a1a2e;
    --primary-light: #2d2d4a;
    --accent: #e94560;
    --accent-soft: #ff6b81;
    --accent-glow: rgba(233, 69, 96, 0.15);
    --teal: #0f3460;
    --text: #1e1e1e;
    --text-light: #666;
    --text-muted: #999;
    --bg: #fafafa;
    --white: #fff;
    --border: #e8e8e8;
    --border-light: #f0f0f0;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
    --shadow-accent: 0 6px 20px rgba(233, 69, 96, 0.2);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
    --max-width: 1100px;
    --nav-h: 70px;
    --transition: all 0.25s ease;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main.container { flex: 1; }
a { text-decoration: none; color: inherit; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* === Navbar === */
.navbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-h);
}

.nav-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-logo {
    height: 36px;
    width: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover { color: var(--primary); }

.nav-logout {
    color: var(--accent) !important;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--primary);
    margin: 5px 0;
    transition: all 0.3s;
    border-radius: 2px;
}

/* === Page Header === */
.page-header {
    margin: 2.5rem 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.page-header .subtitle {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* === Cards === */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.card-header h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
}

/* === Stat Cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-soft));
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover::before { opacity: 1; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-card .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.3rem;
}

/* === Tables === */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead { background: var(--bg); }

th, td {
    padding: 0.85rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--bg); }
tbody tr:last-child td { border-bottom: none; }

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.02em;
}

.badge-active { background: #d1fae5; color: #065f46; }
.badge-invited { background: #dbeafe; color: #1e40af; }
.badge-suspended { background: #fde2e2; color: #991b1b; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-past_due { background: #fef3c7; color: #92400e; }
.badge-canceled { background: #f3f4f6; color: #4b5563; }
.badge-succeeded { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fde2e2; color: #991b1b; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-denied { background: #fde2e2; color: #991b1b; }
.badge-draft { background: #f3f4f6; color: #4b5563; }
.badge-submitted { background: #dbeafe; color: #1e40af; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-completed { background: #d1fae5; color: #065f46; }

/* Priority badges */
.badge-priority-high { background: #fde2e2; color: #991b1b; }
.badge-priority-medium { background: #fef3c7; color: #92400e; }
.badge-priority-low { background: #dbeafe; color: #1e40af; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.4;
    font-family: var(--font);
}

.btn-primary {
    background: var(--accent);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--accent-soft);
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
}

.btn-dark {
    background: var(--primary);
    color: var(--white);
}
.btn-dark:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.btn-success { background: #059669; color: var(--white); }
.btn-success:hover { background: #047857; transform: translateY(-1px); }

.btn-danger { background: #dc2626; color: var(--white); }
.btn-danger:hover { background: #b91c1c; transform: translateY(-1px); }

.btn-outline {
    background: var(--white);
    color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.8rem; font-size: 0.95rem; }

/* === Forms === */
.form-group {
    margin-bottom: 1.4rem;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: var(--font);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
    color: var(--text);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 2.5rem; }

.pin-input {
    letter-spacing: 0.6em;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    max-width: 220px;
    color: var(--primary);
}

/* PIN boxes (individual digit inputs) — matches admin.hamdouchi.com */
.pin-boxes {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 6px 0 4px;
}

.pin-boxes input {
    width: 42px;
    height: 54px;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    font-family: var(--font);
    background: var(--white);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
    -moz-appearance: textfield;
}

.pin-boxes input::-webkit-outer-spin-button,
.pin-boxes input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pin-boxes input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.12);
}

/* === Alerts === */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fde2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* === Auth Pages === */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 15% 50%, rgba(233, 69, 96, 0.08) 0%, transparent 55%),
                radial-gradient(ellipse at 85% 20%, rgba(255, 107, 129, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 100%, rgba(45, 45, 74, 0.12) 0%, transparent 60%),
                linear-gradient(160deg, var(--primary) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 2rem;
}

.auth-page::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0v60M0 30h60' stroke='%23fff' stroke-width='.5' fill='none'/%3E%3C/svg%3E");
    pointer-events: none;
}

.auth-container {
    max-width: 420px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.auth-card .brand {
    text-align: center;
    margin-bottom: 0.5rem;
}

.brand-logo {
    height: 48px;
    width: auto;
}

.auth-card .brand span {
    color: var(--accent);
}

.auth-card h1 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--primary);
    text-align: center;
}

.auth-card p.subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 2rem;
    text-align: center;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent);
    font-weight: 600;
    transition: color 0.2s;
}

.auth-footer a:hover { color: var(--accent-soft); }

/* === Terms === */
.terms-content {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.82rem;
    line-height: 1.8;
    color: var(--text-light);
}

.terms-content h3 {
    font-size: 0.9rem;
    margin: 1rem 0 0.4rem;
    color: var(--primary);
}

.terms-content h3:first-child { margin-top: 0; }

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 0.15rem;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent);
}

.checkbox-group label {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* === Requests Feature === */
.request-card {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 0.75rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.request-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(233, 69, 96, 0.08);
}

.request-card.submitted {
    border-left: 3px solid var(--accent);
}

.request-card.draft {
    border-left: 3px solid var(--border);
}

.request-number {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.request-content { flex: 1; min-width: 0; }

.request-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--primary);
    margin-bottom: 0.2rem;
}

.request-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.request-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.quota-bar {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.quota-visual {
    display: flex;
    gap: 4px;
}

.quota-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    transition: var(--transition);
}

.quota-dot.used {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.quota-info {
    font-size: 0.85rem;
    color: var(--text-light);
}

.quota-info strong {
    color: var(--primary);
    font-weight: 700;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

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

/* === Footer === */
.site-footer {
    background: var(--primary);
    color: rgba(255, 255, 255, 0.6);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
    font-size: 0.8rem;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.2s;
}

.site-footer a:hover { color: var(--accent-soft); }

/* === Utilities === */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* === Animations === */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-up {
    animation: fadeUp 0.5s ease forwards;
}

/* === Responsive === */
@media (max-width: 768px) {
    .navbar {
        background: var(--white);
        backdrop-filter: none;
    }

    .nav-links { display: none; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--nav-h);
        left: 0;
        right: 0;
        background: var(--white);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 0;
        box-shadow: var(--shadow-lg);
    }
    .nav-links.open a {
        padding: 0.75rem 1.5rem;
        width: 100%;
        display: block;
    }
    .nav-toggle { display: block; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }

    .quota-bar { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .request-card { flex-direction: column; align-items: flex-start; }
    .request-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-page { padding: 1rem; }
    .auth-card { padding: 1.75rem; }
    .pin-boxes { gap: 8px; }
    .pin-boxes input { width: 38px; height: 50px; font-size: 20px; }
}
