/* =====================================================
   Cambodia Live Order System – Core Styles
   Supplements Tailwind CSS utility classes
   ===================================================== */

/* CSS custom properties */
:root {
    --primary:        #3B82F6;
    --primary-dark:   #2563EB;
    --primary-light:  #EFF6FF;
    --success:        #10B981;
    --warning:        #F59E0B;
    --danger:         #EF4444;
    --gray-50:        #F9FAFB;
    --sidebar-width:  16rem; /* 256px = Tailwind w-64 */
    --topbar-height:  4rem;  /* 64px  = Tailwind pt-16 */
}

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

body {
    font-family: 'Inter', 'Noto Sans Khmer', system-ui, sans-serif;
    background-color: #F3F4F6;
    color: #111827;
}

/* ----- Form controls ----- */
.input-field {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #111827;
    background-color: #fff;
    border: 1px solid #D1D5DB;
    border-radius: 0.5rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.input-field::placeholder { color: #9CA3AF; }

/* Select arrow */
select.input-field {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
    appearance: none;
}

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s, opacity 0.15s;
    text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }

.btn-outline   { border: 1px solid #D1D5DB; background: #fff; color: #374151; }
.btn-outline:hover { background: #F9FAFB; }

/* ----- Card ----- */
.card {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 1.25rem;
}

/* ----- Status badges ----- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    white-space: nowrap;
}
.badge-pending    { background: #FEF3C7; color: #92400E; }
.badge-confirmed  { background: #DBEAFE; color: #1E40AF; }
.badge-processing { background: #EDE9FE; color: #5B21B6; }
.badge-shipped    { background: #CFFAFE; color: #155E75; }
.badge-delivered  { background: #D1FAE5; color: #065F46; }
.badge-cancelled  { background: #FEE2E2; color: #991B1B; }
.badge-paid       { background: #D1FAE5; color: #065F46; }
.badge-unpaid     { background: #FEF3C7; color: #92400E; }
.badge-cod        { background: #F3F4F6; color: #374151; }

/* ----- Table ----- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    border-bottom: 1px solid #F3F4F6;
    background: #FAFAFA;
}
.data-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #F9FAFB;
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover   { background: #FAFAFA; }

/* ----- Toast container ----- */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 260px;
    max-width: 360px;
    padding: 0.875rem 1rem;
    background: #111827;
    color: #F9FAFB;
    border-radius: 0.875rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    font-size: 0.875rem;
    pointer-events: all;
    animation: toastIn 0.25s ease;
}
.toast-icon { font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger);  }
.toast.info    .toast-icon { color: var(--primary);  }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(0.5rem); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ----- Pagination ----- */
.pagination { display: flex; align-items: center; gap: 0.25rem; }
.page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    border: 1px solid #E5E7EB;
    color: #374151;
    text-decoration: none;
    transition: background 0.1s, border-color 0.1s;
}
.page-item:hover      { background: #F3F4F6; }
.page-item.active     { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.disabled   { opacity: 0.4; pointer-events: none; }

/* ----- Scrollbar (webkit) ----- */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ----- Utility ----- */
.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
