@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   DESIGN SYSTEM TOKENS
   ============================================================ */
:root {
    --primary: #1e40af;       /* Deep blue - ensures white text contrast */
    --primary-hover: #1d3a9e;
    --secondary: #334155;
    --success: #047857;
    --danger: #b91c1c;
    --warning: #b45309;
    --info: #0369a1;
    --background: #f1f5f9;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;    /* Meets WCAG AA on white */
    --border: rgb(203, 213, 225);
}

/* ============================================================
   BASE / RESET
   ============================================================ */
* {
    font-family: 'Plus Jakarta Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--background);
    color: var(--text-main);
}

/* ============================================================
   GLOBAL FORM ACCESSIBILITY
   These rules ensure all form inputs have readable dark text.
   ============================================================ */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea,
select {
    color: #1e293b !important;          /* Dark text always */
    background-color: #ffffff !important;
    border-color: var(--border) !important;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

::placeholder {
    color: #94a3b8 !important;
    opacity: 1;
}

input:focus::placeholder,
textarea:focus::placeholder {
    color: #cbd5e1 !important;
}

/* All labels should be readable */
label {
    color: #1e293b !important;
    font-weight: 700 !important;
}

/* ============================================================
   PREMIUM CARD
   ============================================================ */
.premium-card {
    background: var(--surface);
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

/* ============================================================
   GRADIENT — must always render white text
   ============================================================ */
.premium-gradient {
    background: linear-gradient(135deg, #1e40af 0%, #4338ca 100%) !important;
    color: #ffffff !important;
}

.premium-gradient * {
    color: #ffffff !important;
}

.premium-gradient-success {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%) !important;
    color: #ffffff !important;
}

.premium-gradient-success * {
    color: #ffffff !important;
}

/* ============================================================
   GLASSMORPHISM
   ============================================================ */
.premium-glass {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.premium-shadow {
    box-shadow: 0 25px 50px -12px rgba(30, 64, 175, 0.12);
}

/* ============================================================
   BUTTONS — Global contrast fixes
   ============================================================ */
.btn-primary {
    background: linear-gradient(135deg, #1e40af 0%, #4338ca 100%);
    color: #ffffff !important;
    font-weight: 700;
    transition: all 0.2s;
}

.btn-primary:hover {
    opacity: 0.92;
    transform: scale(1.02);
}

/* Any button with bg-blue-600, bg-indigo-600 etc should have white text */
button[class*="bg-blue-"],
button[class*="bg-indigo-"],
button[class*="bg-emerald-"],
button[class*="bg-rose-"],
button[class*="bg-amber-"],
a[class*="bg-blue-"],
a[class*="bg-indigo-"],
a[class*="bg-emerald-"],
a[class*="bg-rose-"],
a[class*="bg-amber-"] {
    color: #ffffff !important;
}

/* ============================================================
   PRODUCT CARD
   ============================================================ */
.product-card {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid transparent;
}

.product-card:hover {
    transform: translateY(-8px) scale(1.03);
    border-color: rgba(37, 99, 235, 0.2);
    z-index: 10;
}

.product-card:active {
    transform: translateY(-2px) scale(0.98);
}

/* ============================================================
   POS-SPECIFIC
   ============================================================ */
#product-list-container {
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-gutter: stable;
}

#cart-items {
    max-height: calc(100vh - 480px);
    overflow-y: auto;
    padding-right: 4px;
}

@media (max-width: 768px) {
    #cart-items {
        max-height: 400px;
    }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* ============================================================
   TABLE ACCESSIBILITY
   ============================================================ */
th {
    color: #334155 !important;
    font-weight: 800 !important;
}

td {
    color: #1e293b !important;
}

/* Ensure muted/small description text is readable */
p[class*="text-slate-4"],
span[class*="text-slate-4"],
p[class*="text-gray-4"],
span[class*="text-gray-4"] {
    color: #64748b !important;
}

p[class*="text-slate-3"],
span[class*="text-slate-3"] {
    color: #64748b !important;
}