:root {
    --bg: #f5f4f0;
    --surface: #ffffff;
    --text: #1c1917;
    --muted: #57534e;
    --accent: #9a3412;
    --accent-hover: #7c2d12;
    --border: #e7e5e4;
    --success: #15803d;
    --danger: #b91c1c;
    --radius: 8px;
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Login Screen */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

.brand-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.brand-header h1 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
}

.brand-header h1 span {
    color: var(--accent);
    font-family: var(--font-body);
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    display: block;
}

.brand-header p {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 1.25rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.88rem;
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

/* Header */
.admin-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
}

.brand h2 span {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--accent);
    letter-spacing: 0.12em;
    margin-left: 0.3rem;
}

.header-right {
    display: flex;
    gap: 0.75rem;
}

/* KPI Stats */
.admin-main {
    padding: 2rem 1.25rem 4rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.35rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-size: 1.85rem;
    margin-top: 0.35rem;
}

.stat-value.accent {
    color: var(--accent);
}

/* Tabs */
.admin-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.6rem 1.2rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--muted);
    cursor: pointer;
    border-radius: var(--radius);
}

.tab-btn.active {
    background: var(--text);
    color: #fff;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Cards & Layout */
.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.inventory-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.92rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.4rem 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
    cursor: pointer;
}

.help-text {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    padding: 0.7rem 1.25rem;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
}

.btn-block {
    width: 100%;
    margin-top: 0.5rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    padding: 0.85rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.04em;
}

.prod-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.prod-cell img {
    width: 44px;
    height: 54px;
    object-fit: cover;
    border-radius: 4px;
}

.status-select {
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.82rem;
}

.stock-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.stock-in {
    background: #dcfce7;
    color: var(--success);
}

.stock-out {
    background: #fee2e2;
    color: var(--danger);
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text);
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.25s ease;
    z-index: 100;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 960px) {
    .inventory-layout {
        grid-template-columns: 1fr;
    }
}

/* Fix for side-by-side admin form inputs */
.form-row {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.form-row .form-group {
    flex: 1;
    min-width: 0; /* Prevents inputs from breaking out of the container */
}

.form-row input, 
.form-row select {
    width: 100%;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* ==========================================
   MODAL STYLES
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: var(--bg-primary, #ffffff);
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-card h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--text-dark, #111827);
}

.modal-card p {
    color: var(--text-muted, #6b7280);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.admin-login-logo {
    height: 80px;
    width: auto;
    margin-bottom: 0.5rem;
}

.admin-header-logo {
    height: 80px;
    width: auto;
    display: block;
}

/* ==========================================
   AUTO-HIDING ADMIN HEADER
   ========================================== */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 100;
    transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s ease !important;
    will-change: transform;
}

.admin-header.nav-hidden {
    transform: translateY(-120%) !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

