/* ============================================================
   Namat — app.css
   @font-face declarations, CSS custom properties, and all
   custom component classes used across Blade views.
   Loaded alongside Tailwind CDN in layouts/app.blade.php
   ============================================================ */

/* ── Thmanyah Sans ─────────────────────────────────────────── */
@font-face {
    font-family: 'Thmanyah Sans';
    src: url('/fonts/thmanyah/thmanyahsans-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Sans';
    src: url('/fonts/thmanyah/thmanyahsans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Sans';
    src: url('/fonts/thmanyah/thmanyahsans-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Sans';
    src: url('/fonts/thmanyah/thmanyahsans-Bold.woff2') format('woff2');
    font-weight: 600 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Sans';
    src: url('/fonts/thmanyah/thmanyahsans-Black.woff2') format('woff2');
    font-weight: 800 900;
    font-style: normal;
    font-display: swap;
}

/* ── Thmanyah Serif Display ────────────────────────────────── */
@font-face {
    font-family: 'Thmanyah Serif Display';
    src: url('/fonts/thmanyah/thmanyahserifdisplay-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Serif Display';
    src: url('/fonts/thmanyah/thmanyahserifdisplay-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Serif Display';
    src: url('/fonts/thmanyah/thmanyahserifdisplay-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Serif Display';
    src: url('/fonts/thmanyah/thmanyahserifdisplay-Bold.woff2') format('woff2');
    font-weight: 600 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Serif Display';
    src: url('/fonts/thmanyah/thmanyahserifdisplay-Black.woff2') format('woff2');
    font-weight: 800 900;
    font-style: normal;
    font-display: swap;
}

/* ── Thmanyah Serif Text ───────────────────────────────────── */
@font-face {
    font-family: 'Thmanyah Serif Text';
    src: url('/fonts/thmanyah/thmanyahseriftext-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Serif Text';
    src: url('/fonts/thmanyah/thmanyahseriftext-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Serif Text';
    src: url('/fonts/thmanyah/thmanyahseriftext-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Serif Text';
    src: url('/fonts/thmanyah/thmanyahseriftext-Bold.woff2') format('woff2');
    font-weight: 600 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah Serif Text';
    src: url('/fonts/thmanyah/thmanyahseriftext-Black.woff2') format('woff2');
    font-weight: 800 900;
    font-style: normal;
    font-display: swap;
}

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
    --color-beige:       #E8DCC8;
    --color-beige-dark:  #DDD0B3;
    --color-olive:       #4A5240;
    --color-olive-light: #5C6B52;
    --color-black:       #1C1C1C;
    --color-white:       #FFFFFF;

    --font-sans:         'Thmanyah Sans', Arial, sans-serif;
    --font-serif-disp:   'Thmanyah Serif Display', Georgia, serif;
    --font-serif-text:   'Thmanyah Serif Text', Georgia, serif;

    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --radius-xl:  20px;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
    --shadow-md:  0 4px 12px rgba(0,0,0,.10);
    --shadow-lg:  0 8px 28px rgba(0,0,0,.12);
}

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

html {
    direction: rtl;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--color-black);
    background-color: #f5f0e8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Admin panel overrides (LTR, English) */
body.admin-body {
    direction: ltr;
    font-family: Arial, sans-serif;
}

/* ── Utility colour classes ────────────────────────────────── */
.bg-beige       { background-color: var(--color-beige); }
.bg-beige-dark  { background-color: var(--color-beige-dark); }
.bg-olive       { background-color: var(--color-olive); }
.bg-olive-light { background-color: var(--color-olive-light); }
.text-olive     { color: var(--color-olive); }
.text-beige     { color: var(--color-beige); }
.border-beige   { border-color: var(--color-beige); }
.border-beige-dark { border-color: var(--color-beige-dark); }
.border-olive   { border-color: var(--color-olive); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    background-color: var(--color-olive);
    color: var(--color-white);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    border: 2px solid var(--color-olive);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.18s, border-color 0.18s, opacity 0.18s;
    white-space: nowrap;
}
.btn-primary:hover {
    background-color: var(--color-olive-light);
    border-color: var(--color-olive-light);
}
.btn-primary:disabled,
.btn-primary[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    background-color: transparent;
    color: var(--color-olive);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    border: 2px solid var(--color-olive);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.18s, color 0.18s;
    white-space: nowrap;
}
.btn-outline:hover {
    background-color: var(--color-olive);
    color: var(--color-white);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--color-olive);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s;
}
.btn-ghost:hover {
    background-color: var(--color-beige);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    background-color: #dc2626;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    border: 2px solid #dc2626;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.18s;
}
.btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.0625rem;
}

/* ── Form controls ──────────────────────────────────────────── */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-black);
    margin-bottom: 0.375rem;
}

.form-field {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    background-color: var(--color-white);
    color: var(--color-black);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    border: 1.5px solid var(--color-beige-dark);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    -webkit-appearance: none;
}
.form-field:focus {
    border-color: var(--color-olive);
    box-shadow: 0 0 0 3px rgba(74, 82, 64, 0.12);
}
.form-field::placeholder {
    color: #aaa;
}
.form-field[readonly] {
    background-color: #f5f0e8;
    cursor: default;
}

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

select.form-field {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234A5240' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    padding-left: 2.25rem;
}

.form-error {
    font-size: 0.8125rem;
    color: #dc2626;
    margin-top: 0.25rem;
}

.form-hint {
    font-size: 0.8125rem;
    color: #888;
    margin-top: 0.25rem;
}

/* ── Sidebar navigation ─────────────────────────────────────── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}
.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.sidebar-link.active {
    background-color: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: 700;
}
.sidebar-link svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* Admin nav (LTR) */
.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.875rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}
.admin-nav-link:hover {
    background-color: rgba(255,255,255,0.12);
    color: #fff;
}
.admin-nav-link.active {
    background-color: rgba(255,255,255,0.2);
    color: #fff;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-solo {
    background-color: var(--color-beige);
    color: var(--color-olive);
}

.badge-agency {
    background-color: var(--color-olive);
    color: var(--color-white);
}

.badge-success {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background-color: #fef9c3;
    color: #854d0e;
}

.badge-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-neutral {
    background-color: #f3f4f6;
    color: #4b5563;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-beige-dark);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-beige);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-beige);
    background-color: #faf8f4;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Stat card ──────────────────────────────────────────────── */
.stat-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-beige-dark);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.stat-card .stat-label {
    font-size: 0.8125rem;
    color: #888;
    font-weight: 500;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-olive);
    line-height: 1.1;
}
.stat-card .stat-sub {
    font-size: 0.8125rem;
    color: #aaa;
}

/* ── Alert / notice banners ─────────────────────────────────── */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

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

.alert-info {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

/* ── Flash toast ─────────────────────────────────────────────── */
.flash-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 280px;
    max-width: 480px;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    text-align: center;
    pointer-events: none;
    animation: toast-in 0.25s ease forwards;
}
.flash-toast.success { background: #16a34a; color: #fff; }
.flash-toast.error   { background: #dc2626; color: #fff; }
.flash-toast.info    { background: var(--color-olive); color: #fff; }
.flash-toast.warning { background: #d97706; color: #fff; }
.flash-toast.hiding  { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to   { opacity: 0; transform: translateX(-50%) translateY(12px); }
}

/* ── Confirm modal ──────────────────────────────────────────── */
#confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 8888;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
}
#confirm-modal[hidden] { display: none; }
.confirm-box {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 2rem 2.25rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.confirm-box h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 0.625rem;
}
.confirm-box p {
    font-size: 0.9375rem;
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}
.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* ── Colour picker (brand setup) ────────────────────────────── */
.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.selected { border-color: var(--color-olive); }

/* ── Canvas editor panels ───────────────────────────────────── */
.editor-panel {
    background: var(--color-white);
    border: 1px solid var(--color-beige-dark);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.editor-panel-header {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--color-beige);
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--color-olive);
}
.editor-panel-body {
    padding: 1rem 1.25rem;
    flex: 1;
    overflow-y: auto;
}

/* ── Icon grid ──────────────────────────────────────────────── */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 0.5rem;
}
.icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem 0.25rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
    font-size: 0.6875rem;
    color: #666;
    text-align: center;
    overflow: hidden;
}
.icon-item:hover { background-color: var(--color-beige); }
.icon-item.selected {
    border-color: var(--color-olive);
    background-color: var(--color-beige);
}

/* ── Invoice item row grid ──────────────────────────────────── */
.invoice-item-row {
    display: grid;
    grid-template-columns: 1fr 80px 110px 110px 40px;
    gap: 0.5rem;
    align-items: center;
}

/* ── Progress bar ───────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-beige);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--color-olive);
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* ── Section divider ────────────────────────────────────────── */
.section-divider {
    border: none;
    border-top: 1px solid var(--color-beige-dark);
    margin: 1.5rem 0;
}

/* ── Skeleton loader ────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--color-beige) 25%, var(--color-beige-dark) 50%, var(--color-beige) 75%);
    background-size: 200% 100%;
    animation: skeleton-wave 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-wave {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Animate-spin (for loading spinners) ────────────────────── */
.animate-spin {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Locked overlay ─────────────────────────────────────────── */
.locked-overlay {
    position: absolute;
    inset: 0;
    background: rgba(232, 220, 200, 0.82);
    backdrop-filter: blur(3px);
    border-radius: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    z-index: 10;
}
.locked-overlay span {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--color-olive);
}

/* ── Tab pills ──────────────────────────────────────────────── */
.tab-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.tab-pill {
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1.5px solid var(--color-beige-dark);
    background: var(--color-white);
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
}
.tab-pill:hover {
    border-color: var(--color-olive);
    color: var(--color-olive);
}
.tab-pill.active {
    background: var(--color-olive);
    border-color: var(--color-olive);
    color: var(--color-white);
}

/* ── Table ──────────────────────────────────────────────────── */
.table-namat {
    width: 100%;
    border-collapse: collapse;
}
.table-namat th {
    text-align: right;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #888;
    border-bottom: 1px solid var(--color-beige-dark);
    background: #faf8f4;
    white-space: nowrap;
}
.table-namat td {
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    color: var(--color-black);
    border-bottom: 1px solid var(--color-beige);
    vertical-align: middle;
}
.table-namat tbody tr:last-child td { border-bottom: none; }
.table-namat tbody tr:hover td { background-color: #faf8f4; }

/* ── Print-safe helpers ─────────────────────────────────────── */
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ── Responsive tweaks ──────────────────────────────────────── */
@media (max-width: 768px) {
    .invoice-item-row {
        grid-template-columns: 1fr 60px 90px 90px 32px;
    }
    .stat-card .stat-value {
        font-size: 1.375rem;
    }
}

@media (max-width: 480px) {
    .btn-primary,
    .btn-outline {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    .invoice-item-row {
        grid-template-columns: 1fr;
    }
}
