/* ============================================
   INVENTORY MANAGEMENT SYSTEM - STYLESHEET
   ============================================ */

:root {
    --primary: #00264d;
    --primary-light: #1a3a5c;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-900: #0f172a;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --radius: 12px;
    --transition: 0.25s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: #f0f4f8;
    color: #1e293b;
    line-height: 1.6;
}

/* ===== TOP BAR ===== */
.top-bar {
    background: var(--primary);
    color: white;
    padding: 12px 30px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
    display: flex;
    align-items: center;
}
.top-bar-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}
.brand {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand i {
    color: #55efc4;
    font-size: 22px;
}
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.role-badge {
    background: rgba(255,255,255,0.15);
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
}
.logout-btn {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    transition: 0.2s;
}
.logout-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 250px;
    background: white;
    height: calc(100vh - 60px);
    position: fixed;
    top: 60px;
    left: 0;
    border-right: 1px solid var(--gray-200);
    padding: 20px 0;
    overflow-y: auto;
    z-index: 999;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: 0.2s;
    border-left: 3px solid transparent;
}
.nav-link i {
    width: 20px;
    font-size: 16px;
    color: var(--gray-500);
}
.nav-link:hover {
    background: var(--gray-50);
    color: var(--primary);
}
.nav-link.active {
    background: #e8f0fe;
    color: var(--primary);
    border-left-color: var(--primary);
}
.nav-link.active i {
    color: var(--primary);
}
.sidebar-divider {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 15px 24px;
}

/* POS Link - Prominent */
.pos-link {
    background: #00264d !important;
    color: white !important;
    border-radius: 8px;
    margin: 8px 16px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 700;
    border-left: none !important;
}
.pos-link i {
    color: white !important;
    font-size: 20px;
}
.pos-link:hover {
    background: #001a33 !important;
    transform: translateY(-2px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 250px;
    margin-top: 60px;
    padding: 30px;
    min-height: calc(100vh - 60px);
}
.page-container {
    max-width: 1400px;
    margin: 0 auto;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}
.page-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-header p {
    color: var(--gray-500);
    margin-top: 4px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,38,77,0.2);
}
.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}
.btn-secondary:hover {
    background: var(--gray-200);
}
.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}
.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: #16a34a;
    transform: translateY(-2px);
}
.btn-ghost {
    background: transparent;
    color: var(--gray-500);
}
.btn-ghost:hover {
    background: var(--gray-50);
}
.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    color: var(--gray-500);
    text-decoration: none;
    transition: 0.2s;
    border: none;
    cursor: pointer;
}
.btn-icon:hover {
    background: var(--gray-100);
    color: var(--primary);
}
.btn-icon.danger:hover {
    background: #fee2e2;
    color: var(--danger);
}
.btn-icon.success:hover {
    background: #dcfce7;
    color: var(--success);
}

/* ===== FORM ELEMENTS ===== */
.form-card {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-grid .full-width {
    grid-column: 1 / -1;
}
.form-group {
    margin-bottom: 0;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-700);
    font-size: 14px;
}
.form-group .required {
    color: var(--danger);
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    transition: 0.2s;
    font-family: inherit;
    background: white;
}
.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,38,77,0.1);
}
.form-control::placeholder {
    color: var(--gray-300);
}
.form-text {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
    display: block;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
    flex-wrap: wrap;
}
.current-product-info {
    background: #f0f7ff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid var(--info);
}
.current-product-info h3 {
    margin: 0 0 8px;
}
.current-product-info p {
    margin: 4px 0;
}
.current-image {
    margin: 10px 0;
}
.current-image img {
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

/* ===== FILTER BAR ===== */
.filter-bar {
    background: white;
    padding: 15px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    margin-bottom: 25px;
}
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.filter-input, .filter-select {
    padding: 8px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: 0.2s;
    min-width: 150px;
}
.filter-input:focus, .filter-select:focus {
    border-color: var(--primary);
    outline: none;
}

/* ===== TABLES ===== */
.table-container {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 700;
    color: var(--gray-500);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.data-table tbody tr:hover {
    background: var(--gray-50);
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}
.product-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background: #f1f5f9;
}
.product-placeholder {
    width: 50px;
    height: 50px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-success {
    background: #dcfce7;
    color: #166534;
}
.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}
.badge-warning {
    background: #fef3c7;
    color: #92400e;
}
.badge-info {
    background: #dbeafe;
    color: #1e40af;
}
.badge-primary {
    background: #e0f2fe;
    color: #0369a1;
}

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: white;
    padding: 20px 25px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.stat-icon.blue {
    background: #dbeafe;
    color: #2563eb;
}
.stat-icon.green {
    background: #dcfce7;
    color: #16a34a;
}
.stat-icon.yellow {
    background: #fef3c7;
    color: #d97706;
}
.stat-icon.red {
    background: #fee2e2;
    color: #dc2626;
}
.stat-icon.purple {
    background: #ede9fe;
    color: #7c3aed;
}
.stat-icon.indigo {
    background: #e0e7ff;
    color: #4f46e5;
}
.stat-icon.teal {
    background: #ccfbf1;
    color: #0d9488;
}
.stat-info h3 {
    font-size: 24px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
    margin: 0;
}
.stat-info p {
    color: var(--gray-500);
    font-size: 13px;
    margin: 0;
}

/* ===== CHARTS ===== */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}
.chart-card {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}
.chart-card h3 {
    margin: 0 0 20px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.chart-container {
    height: 300px;
    position: relative;
}

/* ===== PRODUCT RANKINGS ===== */
.product-rankings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}
.ranking-card {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}
.ranking-card h3 {
    margin: 0 0 20px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.rank-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}
.rank-item:last-child {
    border-bottom: none;
}
.rank-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background: #f1f5f9;
}
.rank-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.rank-name {
    font-weight: 600;
}
.rank-count {
    font-size: 13px;
    color: var(--gray-500);
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}
.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.text-danger {
    color: var(--danger);
}
.text-success {
    color: var(--success);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}
.empty-state i {
    font-size: 48px;
    color: var(--gray-300);
    margin-bottom: 15px;
    display: block;
}
.empty-state h3 {
    font-size: 18px;
    color: var(--gray-700);
    margin-bottom: 8px;
}
.empty-state p {
    color: var(--gray-500);
    margin-bottom: 20px;
}

/* ===== SUGGESTIONS ===== */
.suggestions-container {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    z-index: 9999;
    max-height: 450px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
}
.suggestions-container::-webkit-scrollbar {
    width: 6px;
}
.suggestions-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}
.suggestions-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.suggestion-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    text-decoration: none;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    cursor: pointer;
}
.suggestion-item:hover {
    background: #f8fafc;
    transform: translateX(4px);
}
.suggestion-item:last-child {
    border-bottom: none;
}
.suggestion-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}
.suggestion-info {
    flex: 1;
    min-width: 0;
}
.suggestion-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 15px;
    margin-bottom: 2px;
}
.suggestion-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}
.suggestion-category {
    background: #f0f7ff;
    color: #0369a1;
    padding: 1px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
}
.suggestion-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}
.suggestion-price {
    font-weight: 700;
    color: #00264d;
}
.suggestion-empty {
    padding: 30px 20px;
    text-align: center;
    color: #94a3b8;
}
.suggestion-empty i {
    font-size: 30px;
    display: block;
    margin-bottom: 10px;
    color: #cbd5e1;
}

/* ===== RECEIPT ===== */
.receipt-container {
    font-family: 'Courier New', monospace;
}
#receiptContainer {
    max-width: 400px;
    margin: 0 auto 30px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* ===== FOOTER ===== */
.inventory-footer {
    background: #0a1628;
    color: #cbd5e1;
    padding: 25px 30px 15px;
    margin-top: 40px;
    border-top: 3px solid #00264d;
}
.footer-container {
    max-width: 1400px;
    margin: 0 auto;
}
.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.footer-logo {
    font-size: 22px;
    color: #55efc4;
}
.footer-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.footer-text strong {
    font-size: 16px;
    color: white;
    font-weight: 800;
    letter-spacing: 0.5px;
}
.footer-text span {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.footer-divider {
    color: rgba(255,255,255,0.15);
    font-size: 18px;
}
.footer-company {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #e2e8f0;
}
.footer-company i {
    color: #55efc4;
    font-size: 15px;
}
.footer-date {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #94a3b8;
}
.footer-date i {
    color: #55efc4;
    font-size: 14px;
}
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    font-size: 12px;
    color: #64748b;
}
.footer-version {
    background: rgba(255,255,255,0.06);
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #64748b;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body * {
        visibility: hidden;
    }
    #receiptContainer, #receiptContainer * {
        visibility: visible;
    }
    #receiptContainer {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
        padding: 20px;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: white;
        font-size: 12px;
    }
    .top-bar, .sidebar, .page-header, .btn, .form-card, .filter-bar, 
    .stats-grid, .charts-grid, .table-container, .product-rankings-grid,
    .no-print, .page-container > *:not(#receiptContainer) {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .product-rankings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: 0.3s;
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .page-header h1 {
        font-size: 22px;
    }
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .footer-divider {
        display: none;
    }
    .footer-brand {
        flex-direction: column;
        text-align: center;
    }
    .footer-text {
        align-items: center;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .top-bar {
        padding: 8px 15px;
        height: 55px;
    }
    .brand {
        font-size: 15px;
    }
    .brand i {
        font-size: 18px;
    }
    .user-badge {
        font-size: 12px;
    }
    .role-badge {
        display: none;
    }
    .logout-btn span {
        display: none;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .filter-form {
        flex-direction: column;
    }
    .filter-input, .filter-select {
        width: 100%;
        min-width: unset;
    }
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .page-header h1 {
        font-size: 20px;
    }
    .data-table {
        font-size: 13px;
    }
    .data-table th, .data-table td {
        padding: 8px 10px;
    }
    .form-card {
        padding: 20px 15px;
    }
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
    .suggestions-container {
        max-height: 350px;
        top: calc(100% + 3px);
        border-radius: 8px;
    }
    .suggestion-item {
        padding: 10px 12px;
        gap: 10px;
    }
    .suggestion-img {
        width: 40px;
        height: 40px;
    }
    .suggestion-name {
        font-size: 13px;
    }
}

/* Mobile Toggle Button */
.mobile-toggle-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #00264d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
@media (max-width: 992px) {
    .mobile-toggle-btn {
        display: flex !important;
    }
}