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

/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #a855f7;
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --bg-dark: #0b0f1a;
    --card-bg: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --text-main: #f1f5f9;
    --text-muted: #64748b;
    --sidebar-w: 210px;
}

body {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(ellipse at 0% 0%, rgba(99,102,241,0.12) 0, transparent 55%),
        radial-gradient(ellipse at 100% 100%, rgba(168,85,247,0.10) 0, transparent 55%);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
aside {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: rgba(10, 15, 30, 0.95);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    height: 100vh;
    position: sticky;
    top: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 8px 4px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.nav-menu { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(168,85,247,0.2));
    color: #c4b5fd;
    border: 1px solid rgba(99,102,241,0.3);
}

/* ===== MAIN LAYOUT ===== */
main {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== PAGE SECTIONS ===== */
#sectionDashboard,
#sectionPurchase,
#sectionProducts,
#sectionInventory { display: flex; flex-direction: column; gap: 16px; }

/* ===== HEADER ===== */
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.header-section h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-section p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 2px 10px rgba(99,102,241,0.3);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-outline {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }

.btn-sm { padding: 4px 10px; font-size: 0.75rem; border-radius: 6px; }
.btn-danger { background: rgba(244,63,94,0.15); color: var(--danger); border: 1px solid rgba(244,63,94,0.3); }
.btn-danger:hover { background: rgba(244,63,94,0.25); }

/* ===== CARD GRID (PO Cards) ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    transition: all 0.2s ease;
}

.card:hover {
    border-color: rgba(99,102,241,0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-pending  { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.status-partial  { background: rgba(99,102,241,0.1); color: #a5b4fc;        border: 1px solid rgba(99,102,241,0.3); }
.status-completed{ background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }

/* ===== PROGRESS BAR ===== */
.progress-track {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    margin: 10px 0;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: 6px;
    transition: width 0.8s ease-out;
}

/* ===== TABLE ===== */
.table-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; min-width: 600px; }

thead { background: rgba(255,255,255,0.03); }

th {
    text-align: left;
    padding: 9px 14px;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.06em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.83rem;
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.price-tag  { font-weight: 600; color: var(--success); font-variant-numeric: tabular-nums; }
.debt-tag   { font-weight: 600; color: var(--danger);  font-variant-numeric: tabular-nums; }

/* ===== MODAL ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: none;   /* ← ẨN MẶC ĐỊNH */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: #13192b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 18px;
    padding: 24px 28px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    animation: modalIn 0.25s ease-out;
}

/* Modal rộng cho tạo PO */
.modal-po {
    max-width: 960px !important;
    max-height: 88vh !important;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-content h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }

/* ===== FORM ===== */
.form-group { margin-bottom: 14px; }

label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

textarea { resize: vertical; min-height: 80px; }

/* ===== ANIMATIONS ===== */
.animate-in {
    animation: slideUp 0.35s ease-out both;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== PRODUCT IMAGE ===== */
.prod-img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Xóa nút mũi tên lên/xuống ở các ô nhập số để tiết kiệm diện tích */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}
