/* Ammani Orders — Custom Styles */

/* Golden ratio spacing system: 1, 1.618, 2.618, 4.236, 6.854 */
:root {
    --phi: 1.618;
    --space-1: 0.382rem;
    --space-2: 0.618rem;
    --space-3: 1rem;
    --space-4: 1.618rem;
    --space-5: 2.618rem;
    --space-6: 4.236rem;

    --terracotta: #C84B31;
    --terracotta-dark: #8B2E1F;
    --saffron: #D4A24C;
    --emerald: #2E8B57;
    --brown: #3D2817;
    --ivory: #FBF6EE;

    --sidebar-width: 190px;
    --panel-width: 320px;
    --topbar-height: 56px;
}

/* ─── Zellige pattern (SVG, 2% opacity) ─── */
.zellige-bg {
    background-color: var(--ivory);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 20 L20 0 L40 20 L20 40 Z' fill='none' stroke='%23C84B31' stroke-width='0.5' opacity='0.06'/%3E%3Cpath d='M10 10 L30 10 L30 30 L10 30 Z' fill='none' stroke='%23D4A24C' stroke-width='0.3' opacity='0.04'/%3E%3C/svg%3E");
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--brown) 0%, #2A1B0E 100%);
    flex-shrink: 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.618rem;
    padding: 0.618rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    color: rgba(255,255,255,0.65);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
}

.sidebar-nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.sidebar-nav-item.active {
    background: linear-gradient(135deg, var(--terracotta), #E05A3A);
    color: white;
    box-shadow: 0 4px 12px rgba(200,75,49,0.35);
}

.sidebar-badge {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 1.4rem;
    text-align: center;
}

.sidebar-nav-item.active .sidebar-badge {
    background: rgba(255,255,255,0.25);
}

/* ─── Action Panel ─── */
.action-panel {
    width: var(--panel-width);
    min-width: var(--panel-width);
    background: white;
    border-left: 1px solid #E8DFD0;
    height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-panel-enter {
    transform: translateX(var(--panel-width));
}

/* ─── Table (Google Sheets style) ─── */
.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.orders-table thead tr {
    background: var(--brown);
    color: white;
}

.orders-table thead th {
    padding: 0.618rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.orders-table tbody tr {
    border-bottom: 1px solid #F0E8DC;
    cursor: pointer;
    transition: background 0.1s;
}

.orders-table tbody tr:hover {
    background: #FDF8F2;
}

.orders-table tbody tr.selected {
    background: #FEF3EE;
    outline: 2px solid var(--terracotta);
    outline-offset: -2px;
}

.orders-table tbody tr.priority-row {
    background: linear-gradient(90deg, rgba(200,75,49,0.06) 0%, transparent 100%);
}

.orders-table td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}

/* ─── Action buttons row (below data row) ─── */
.row-actions {
    display: flex;
    gap: 0.382rem;
    padding: 0.25rem 0.75rem 0.5rem;
    background: rgba(0,0,0,0.015);
    border-bottom: 1px solid #EFE7D6;
}

.row-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.618rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.row-btn-call    { background: #EFF6FF; color: #1D4ED8; }
.row-btn-wa      { background: #F0FDF4; color: #15803D; }
.row-btn-claim   { background: var(--terracotta); color: white; }
.row-btn-call:hover  { background: #DBEAFE; }
.row-btn-wa:hover    { background: #DCFCE7; }
.row-btn-claim:hover { background: var(--terracotta-dark); }

/* ─── Status Action Grid (6 buttons) ─── */
.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.618rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.382rem;
    padding: 0.875rem 0.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.action-btn-confirm { background: #F0FDF4; color: #15803D; border-color: #BBF7D0; }
.action-btn-cancel  { background: #FFF1F2; color: #BE123C; border-color: #FECDD3; }
.action-btn-no-ans  { background: #F8FAFC; color: #475569; border-color: #E2E8F0; }
.action-btn-reschedule { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.action-btn-edit    { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.action-btn-release { background: #FFF7ED; color: #C2410C; border-color: #FED7AA; }

.action-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.action-btn:active { transform: translateY(0); }

/* ─── Mobile cards ─── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .action-panel { display: none; }
    .mobile-nav { display: flex; }
    .desktop-only { display: none; }
}

@media (min-width: 769px) {
    .mobile-nav { display: none; }
    .mobile-only { display: none; }
}

.order-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #EDE3D5;
    overflow: hidden;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(61,40,23,0.06);
    transition: box-shadow 0.15s;
}

.order-card:hover {
    box-shadow: 0 4px 16px rgba(61,40,23,0.12);
}

.order-card.priority {
    border-left: 4px solid var(--terracotta);
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.badge-priority   { background: rgba(200,75,49,0.1); color: var(--terracotta); }
.badge-courier-ok { background: rgba(46,139,87,0.1); color: var(--emerald); }
.badge-pending    { background: rgba(212,162,76,0.15); color: #B45309; }
.badge-urgent     { background: #FEF3C7; color: #92400E; }
.badge-critical   { background: #FEE2E2; color: #991B1B; }

/* ─── Toast ─── */
.toast-container {
    position: fixed;
    bottom: 1.618rem;
    right: 1.618rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.618rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.618rem;
    padding: 0.875rem 1.236rem;
    border-radius: 0.75rem;
    background: var(--brown);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    animation: toast-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 380px;
}

.toast.success { background: var(--emerald); }
.toast.error   { background: #DC2626; }
.toast.warning { background: #D97706; }

@keyframes toast-in {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ─── Lock countdown ─── */
.lock-countdown {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--saffron);
    background: rgba(212,162,76,0.1);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
}

.lock-countdown.expiring { color: var(--terracotta); background: rgba(200,75,49,0.1); }

/* ─── Wallet cards ─── */
.wallet-card {
    background: white;
    border-radius: 1rem;
    padding: 1.618rem;
    box-shadow: 0 2px 8px rgba(61,40,23,0.06);
    border: 1px solid #EDE3D5;
    text-align: center;
}

.wallet-amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brown);
    line-height: 1;
}

.wallet-label {
    font-size: 0.8rem;
    color: var(--brownLight, #8B6F47);
    margin-top: 0.382rem;
}

/* ─── Search input ─── */
.search-input {
    background: white;
    border: 1.5px solid #E8DFD0;
    border-radius: 0.625rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    color: var(--brown);
    width: 100%;
    transition: border-color 0.15s;
}

.search-input:focus {
    outline: none;
    border-color: var(--terracotta);
    box-shadow: 0 0 0 3px rgba(200,75,49,0.12);
}

/* ─── Priority toggle ─── */
.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.382rem;
    padding: 0.5rem 0.875rem;
    border-radius: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid #E8DFD0;
    background: white;
    color: #6B7280;
    transition: all 0.15s;
}

.toggle-btn.active {
    background: var(--terracotta);
    border-color: var(--terracotta);
    color: white;
}

/* ─── Spinner ─── */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2.5px solid rgba(200,75,49,0.2);
    border-top-color: var(--terracotta);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C8B99A; border-radius: 999px; }

/* ─── Transitions ─── */
.fade-enter-active, .fade-leave-active { transition: opacity 0.2s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

.slide-right-enter-active, .slide-right-leave-active { transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.slide-right-enter-from { transform: translateX(100%); }
.slide-right-leave-to { transform: translateX(100%); }

/* ─── Bottom sheet (mobile) ─── */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1.618rem;
    z-index: 500;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 499;
}

/* ─── Admin KPI cards ─── */
.kpi-card {
    background: white;
    border-radius: 1rem;
    padding: 1.236rem 1.618rem;
    border: 1px solid #EDE3D5;
    box-shadow: 0 2px 8px rgba(61,40,23,0.04);
}

.kpi-value {
    font-size: 2.618rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--brown) 0%, var(--brownMid, #5C3A20) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── Sub-panel animations ─── */
.sub-panel {
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
}

.sub-panel-enter { max-height: 0; opacity: 0; }
.sub-panel-open  { max-height: 600px; opacity: 1; }

/* ─── Login page ─── */
.login-logo {
    font-size: 2.618rem;
    font-weight: 800;
    color: var(--brown);
    letter-spacing: -0.03em;
}

.login-card {
    background: white;
    border-radius: 1.5rem;
    padding: 2.618rem;
    box-shadow: 0 20px 60px rgba(61,40,23,0.15);
    width: 100%;
    max-width: 400px;
}

/* ─── Topbar ─── */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid #E8DFD0;
    display: flex;
    align-items: center;
    padding: 0 1.618rem;
    gap: 1rem;
    flex-shrink: 0;
}

/* ─── City dropdown ─── */
.city-dropdown {
    position: relative;
}

.city-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1.5px solid #E8DFD0;
    border-radius: 0.625rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
}

.city-option {
    padding: 0.5rem 0.875rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--brown);
}

.city-option:hover { background: var(--ivory); }
.city-option.selected { background: rgba(200,75,49,0.08); font-weight: 600; color: var(--terracotta); }

/* ─── Mobile nav bar ─── */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #E8DFD0;
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.618rem 0.25rem;
    gap: 0.2rem;
    cursor: pointer;
    color: #9CA3AF;
    font-size: 0.6rem;
    font-weight: 600;
    position: relative;
    transition: color 0.15s;
}

.mobile-nav-item.active { color: var(--terracotta); }

.mobile-nav-badge {
    position: absolute;
    top: 0.382rem;
    right: 30%;
    background: var(--terracotta);
    color: white;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0 0.3rem;
    min-width: 1rem;
    text-align: center;
}
