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

:root {
    --primary: #4F46E5;      /* Vibrant Indigo */
    --primary-alt: #4338CA;
    --primary-light: #EEF2FF;
    --secondary: #06B6D4;    /* Cyan */
    --accent: #F59E0B;
    --danger: #EF4444;
    --success: #10B981;
    --background: #F3F4F6;
    --surface: #FFFFFF;
    --glass: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.6);
    --text: #111827;
    --text-muted: #6B7280;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.1), 0 8px 10px -6px rgba(79, 70, 229, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(79, 70, 229, 0.15), 0 10px 10px -5px rgba(79, 70, 229, 0.04);
    --radius: 14px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--background);
    background-image: radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.03) 0%, transparent 50%), radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.03) 0%, transparent 50%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.glass {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.glass:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.9);
}

.glass-blur {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px; /* Slightly sharper than glass radius */
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-alt));
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #059669);
    color: white;
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* Auth Page */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
}

.logo-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--primary);
}

/* ===== Dashboard Charts ===== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    margin-top: 20px;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    padding: 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    height: 100%;
    overflow-y: auto;
    flex-shrink: 0;
    background: linear-gradient(160deg, #1e1b4b 0%, #312e81 100%);
    box-shadow: 4px 0 25px rgba(0,0,0,0.1);
    color: white;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Grid & Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.product-card {
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

.product-photo {
    width: 100%;
    height: 100px;
    border-radius: 6px;
    object-fit: cover;
    margin-bottom: 8px;
    transition: transform 0.3s ease;
}

.product-card:hover .product-photo {
    transform: scale(1.05);
}

/* Tables */
.table-container {
    margin-top: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== Excel-Style Table ===== */
.excel-table {
    width: 100% !important;
    border-collapse: collapse;
    font-size: 0.88rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 6px;
    overflow: hidden;
}

.excel-table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 2px solid rgba(148, 163, 184, 0.2);
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.excel-table tbody td {
    padding: 8px 14px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: var(--text);
    vertical-align: middle;
    font-size: 0.85rem;
}

/* Zebra striping */
.excel-table tbody tr:nth-child(even) {
    background: rgba(148, 163, 184, 0.04);
}

.excel-table tbody tr:nth-child(odd) {
    background: transparent;
}

/* Row hover */
.excel-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.06) !important;
    transition: background 0.15s ease;
}

/* Index column (#) */
.excel-table .col-index {
    width: 45px;
    min-width: 45px;
    max-width: 55px;
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.excel-table thead th.col-index {
    text-align: center;
}

/* Numeric columns alignment */
.excel-table .col-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Actions column */
.excel-table .col-actions {
    text-align: right;
    white-space: nowrap;
    width: 1%;
}

/* Shrink column */
.excel-table .col-shrink {
    width: 1%;
    white-space: nowrap;
}

/* tfoot styling */
.excel-table tfoot td {
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(30, 27, 75, 0.06);
    font-weight: 700;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Print Specific */
@media screen {
    .print-only {
        display: none !important;
    }
}

@page {
    margin: 0;
}

@media print {
    body {
        background: #fff !important;
        padding: 0;
        margin: 0;
    }

    .app-container {
        display: none !important;
    }

    #invoice-slip, #invoice-slip * {
        visibility: visible;
    }

    #invoice-slip {
        display: block !important;
        width: 100%;
        max-width: 72mm;
        margin: 0 auto;
        padding: 0 2mm;
        box-sizing: border-box;
        color: #000 !important;
        background: #fff !important;
        font-family: 'Courier New', Courier, monospace;
        font-size: 9pt;
        font-weight: normal;
        line-height: 1.1;
    }

    #invoice-slip th,
    #invoice-slip td {
        padding: 0;
        border: none;
    }

    .no-print {
        display: none !important;
    }
}

/* ===== DataTables Customization ===== */
.dataTables_wrapper {
    margin-top: 10px;
}
.dataTables_wrapper .dt-buttons {
    margin-bottom: 15px;
}
.dataTables_wrapper .dt-buttons .dt-button {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text);
    font-size: 0.85rem;
    transition: all 0.2s;
    cursor: pointer;
}
.dataTables_wrapper .dt-buttons .dt-button:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 15px;
}
.dataTables_wrapper .dataTables_filter input {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text);
    outline: none;
    margin-left: 8px;
    font-size: 0.85rem;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary);
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 15px !important;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 5px 12px !important;
    border-radius: 6px !important;
    border: 1px solid transparent !important;
    margin-left: 5px !important;
    cursor: pointer;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: white !important;
    border: 1px solid var(--primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:not(.current):hover {
    background: rgba(79, 70, 229, 0.1) !important;
    border: 1px solid var(--primary) !important;
    color: var(--primary) !important;
}