:root {
    --bg-color: #0d0f12;
    --sidebar-bg: rgba(20, 24, 30, 0.7);
    --card-bg: rgba(28, 33, 40, 0.8);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --gold-primary: #eab308;
    --gold-hover: #ca8a04;
    --gold-gradient: linear-gradient(135deg, #fcd34d, #d97706);
    --red-alert: #ef4444;
    --green-success: #22c55e;
    --glass-blur: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.app-container {
    display: flex;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(234, 179, 8, 0.1) 0%, transparent 40%),
        radial-gradient(circle at bottom right, rgba(234, 179, 8, 0.05) 0%, transparent 40%);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.gold-text {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(234, 179, 8, 0.1);
    color: var(--gold-primary);
}

.nav-item.active i {
    color: var(--gold-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-header {
    height: 80px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(13, 15, 18, 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
}

h1#page-title {
    font-size: 24px;
    font-weight: 600;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    width: 300px;
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2);
}

.search-box i {
    color: var(--text-secondary);
    margin-right: 10px;
}

.search-box input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
    width: 100%;
    font-family: inherit;
}

.page-container {
    padding: 32px;
    flex: 1;
    position: relative;
    overflow-y: auto;
}

.page {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards & Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(234, 179, 8, 0.1);
    border-color: rgba(234, 179, 8, 0.3);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(234, 179, 8, 0.1);
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-info p {
    font-size: 28px;
    font-weight: 700;
    color: white;
}

.dashboard-sections,
.split-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

@media (max-width: 900px) {

    .dashboard-sections,
    .split-layout {
        grid-template-columns: 1fr;
    }
}

.section-card,
.form-card,
.list-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

h2 {
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
    color: white;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    color: var(--text-primary);
    font-size: 15px;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Forms */
.product-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

input,
select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--gold-primary);
    background: rgba(0, 0, 0, 0.4);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--gold-gradient);
    color: #000;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(234, 179, 8, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 16px;
}

.btn-danger:hover {
    background: var(--red-alert);
    color: white;
}

.w-100 {
    width: 100%;
}

.mt-3 {
    margin-top: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 32px;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.3s;
}

.close-modal:hover {
    color: white;
}

/* Receipt UI */
.receipt-layout {
    max-width: 600px;
    margin: 0 auto;
}

.receipt-item-selection {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.receipt-item-selection h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--gold-primary);
}

.receipt-summary-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.summary-line.total {
    color: var(--gold-primary);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 0;
    margin-top: 12px;
}

hr {
    border: none;
    border-top: 1px dashed var(--border-color);
}

/* PDF/Printable Receipt View */
.receipt-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.printable-receipt {
    background: white;
    color: black;
    padding: 40px;
    border-radius: 8px;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.receipt-header {
    text-align: center;
    border-bottom: 2px solid #ddd;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.receipt-header h2 {
    color: #333;
    font-size: 28px;
    margin-bottom: 8px;
}

.receipt-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.receipt-item-info {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    align-items: flex-start;
}

.receipt-item-photo {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    border: 1px solid #ddd;
    object-fit: cover;
}

.receipt-meta-container {
    flex: 1;
}

.receipt-meta-container p {
    margin-bottom: 8px;
}

.receipt-details-table {
    width: 100%;
    margin-bottom: 24px;
}

.receipt-details-table th,
.receipt-details-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    color: black;
}

.receipt-details-table th {
    background: #f9f9f9;
}

.receipt-breakdown {
    width: 300px;
    margin-left: auto;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.total-row {
    font-weight: bold;
    font-size: 18px;
    border-top: 2px solid #ddd;
    margin-top: 8px;
    padding-top: 12px;
}

.receipt-footer {
    text-align: center;
    margin-top: 40px;
}

.qr-box {
    margin: 0 auto 16px;
    width: 128px;
    height: 128px;
}



/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }

    #printable-receipt,
    #printable-receipt * {
        visibility: visible;
    }

    #printable-receipt {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
        padding: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        background: var(--bg-color);
        z-index: 100;
    }

    .sidebar-header {
        padding: 16px;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 8px 16px;
        gap: 12px;
    }

    .nav-item {
        padding: 10px 16px;
        font-size: 14px;
        white-space: nowrap;
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.05);
    }

    .top-header {
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 12px;
        position: relative;
    }

    .header-right,
    .search-box {
        width: 100%;
    }

    .page-container {
        padding: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    .dashboard-sections,
    .split-layout {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 16px;
        padding: 20px;
        max-height: calc(100vh - 32px);
    }

    .receipt-actions {
        flex-direction: column;
    }

    .receipt-actions button {
        width: 100%;
    }

    .printable-receipt {
        padding: 20px;
    }

    .receipt-item-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .receipt-item-photo {
        max-width: 100px;
        max-height: 100px;
    }

    .receipt-breakdown {
        width: 100%;
        margin-left: 0;
        margin-top: 24px;
    }
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--card-bg);
    border-left: 4px solid var(--gold-primary);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s forwards, fadeOut 0.3s 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.success {
    border-color: var(--green-success);
}

.toast.error {
    border-color: var(--red-alert);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}