/* =====================================================
   JILACO — Professional Design System
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #e11d48;
    --primary-dark: #be123c;
    --primary-light: #fff1f2;
    --secondary: #0f172a;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #2563eb;
    --info-bg: #dbeafe;
    --light: #f8fafc;
    --border: #e2e8f0;
    --border-focus: #e11d48;
    --text: #0f172a;
    --text-secondary: #334155;
    --muted: #64748b;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.08);
    --input-h: 44px;
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: #f1f5f9;
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    font-size: 14.5px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.form-group label input[type="checkbox"],
.form-group label input[type="radio"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    vertical-align: middle;
    cursor: pointer;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="file"],
input[type="search"],
select,
textarea {
    width: 100%;
    height: var(--input-h);
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14.5px;
    font-family: var(--font);
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    -webkit-appearance: none;
}

textarea.form-control,
textarea {
    height: auto;
    min-height: 96px;
    padding: 12px 14px;
    resize: vertical;
    line-height: 1.5;
}

select.form-control,
select {
    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='%2364748b' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

input[type="file"] {
    padding: 10px 14px;
    height: auto;
    background: var(--light);
    cursor: pointer;
}

.form-control:hover,
input:hover:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
select:hover,
textarea:hover {
    border-color: #cbd5e1;
}

.form-control:focus,
input:focus:not([type="checkbox"]):not([type="radio"]),
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px rgba(225, 29, 72, 0.12);
}

.form-control:disabled,
input:disabled,
select:disabled {
    background: #f1f5f9;
    color: var(--muted);
    cursor: not-allowed;
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

.form-row,
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint,
.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

/* Checkbox / Radio group */
.checkbox-label,
.radio-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-weight: 500 !important;
    cursor: pointer;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s;
    margin-bottom: 8px;
}

.checkbox-label:hover,
.radio-label:hover {
    border-color: #cbd5e1;
    background: var(--light);
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--input-h);
    padding: 0 20px;
    border-radius: var(--radius);
    font-size: 14.5px;
    font-weight: 600;
    font-family: var(--font);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: #fff !important;
    border-color: var(--primary);
}

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

.btn-outline {
    background: #fff;
    border-color: var(--border);
    color: var(--text) !important;
}

.btn-outline:hover {
    border-color: #cbd5e1;
    background: var(--light);
    color: var(--text) !important;
}

.btn-success {
    background: var(--success);
    color: #fff !important;
    border-color: var(--success);
}

.btn-success:hover { background: #15803d; border-color: #15803d; }

.btn-danger {
    background: var(--danger);
    color: #fff !important;
    border-color: var(--danger);
}

.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-sm {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-lg {
    height: 50px;
    padding: 0 28px;
    font-size: 16px;
}

.btn-block,
.btn-primary.btn-block {
    width: 100%;
}

/* Auth forms often use full width primary */
.auth-card .btn-primary { width: 100%; }

/* ========== ALERTS ========== */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 18px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert-success {
    background: var(--success-bg);
    color: #166534;
    border-color: #bbf7d0;
}

.alert-error,
.alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border-color: #fecaca;
}

.alert-info {
    background: var(--info-bg);
    color: #1e40af;
    border-color: #bfdbfe;
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border-color: #fde68a;
}

/* ========== CARDS ========== */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.card h2, .card h3 {
    color: var(--text);
    font-weight: 700;
}

/* ========== TABLES ========== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th,
.table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table th {
    font-weight: 600;
    color: var(--muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--light);
}

.table tbody tr:hover {
    background: #fafbfc;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.badge-active, .badge-delivered, .badge-resolved, .badge-approved, .badge-paid {
    background: var(--success-bg); color: #166534;
}
.badge-pending, .badge-placed, .badge-open {
    background: var(--warning-bg); color: #92400e;
}
.badge-rejected, .badge-cancelled, .badge-blocked {
    background: var(--danger-bg); color: #991b1b;
}
.badge-shipped, .badge-confirmed, .badge-packed, .badge-in_progress {
    background: var(--info-bg); color: #1e40af;
}

/* ========== AUTH ========== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(145deg, #fff1f2 0%, #f1f5f9 45%, #e0f2fe 100%);
}

.auth-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.6px;
}

.auth-logo p {
    color: var(--muted);
    font-size: 13.5px;
    margin-top: 4px;
}

.auth-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
    text-align: center;
    color: var(--text);
}

.auth-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
    margin-bottom: 28px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13.5px;
    color: var(--muted);
}

.auth-footer a {
    font-weight: 600;
}

/* ========== STAT CARDS ========== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-card .num {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-card .label {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 6px;
    font-weight: 500;
}

/* ========== SETTINGS TABS ========== */
.settings-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.settings-tabs a {
    padding: 11px 18px;
    text-decoration: none;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    border-radius: 8px 8px 0 0;
}

.settings-tabs a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.settings-tabs a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* ========== TOGGLE SWITCH ========== */
.toggle-switch {
    position: relative;
    width: 46px;
    height: 26px;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 26px;
    transition: 0.2s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ========== PRODUCT CARDS (Customer) ========== */
.product-card {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.product-card .img-wrap {
    aspect-ratio: 1;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-card .img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card .info {
    padding: 14px 16px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card .name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .price {
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
    margin-top: auto;
}

.product-card .mrp {
    font-size: 13px;
    color: var(--muted);
    text-decoration: line-through;
    font-weight: 500;
    margin-left: 6px;
}

/* ========== MISC ========== */
code {
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 12px;
    background: var(--light);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

h1, h2, h3, h4 {
    line-height: 1.3;
    color: var(--text);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .form-row, .form-row-2 {
        grid-template-columns: 1fr;
    }
    .auth-card {
        padding: 28px 22px;
    }
    .card {
        padding: 18px;
    }
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .table {
        font-size: 12.5px;
    }
    .table th, .table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .stat-card {
        padding: 14px;
    }
    .stat-card .num {
        font-size: 20px;
    }
}

/* =====================================================
   RESPONSIVE — Mobile / Tablet / Desktop
   ===================================================== */

/* Touch-friendly defaults */
@media (hover: none) and (pointer: coarse) {
    .btn, .btn-sm, a, button {
        min-height: 44px;
    }
    .form-control, input, select, textarea {
        font-size: 16px !important; /* prevent iOS zoom */
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .container {
        padding: 0 16px;
    }
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile + small tablet */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    .container {
        padding: 0 12px;
    }
    .auth-card {
        padding: 24px 18px;
        border-radius: 14px;
        max-width: 100%;
    }
    .auth-logo h1 {
        font-size: 24px;
    }
    .card {
        padding: 16px;
        border-radius: 12px;
    }
    .form-row, .form-row-2 {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-card {
        padding: 14px;
    }
    .stat-card .num {
        font-size: 20px;
    }
    .btn {
        width: 100%;
    }
    .btn-sm {
        width: auto;
    }
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -4px;
    }
    .table {
        min-width: 560px;
        font-size: 12.5px;
    }
    .settings-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }
    .settings-tabs a {
        white-space: nowrap;
        padding: 10px 14px;
        font-size: 13px;
    }
    h1 { font-size: 20px !important; }
    h2 { font-size: 18px !important; }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .auth-wrapper {
        padding: 12px;
    }
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
}
