/* assets/css/custom.css */

:root {
    /* Palette High Contrast & Purified */
    --primary-color: #4f46e5;
    /* Indigo vibrant */
    --secondary-color: #10b981;
    /* Emerald */
    --dark-bg: #111827;
    /* Very dark gray/black for sidebar */
    --light-bg: #f3f4f6;
    /* Light gray for main content */
    --white: #ffffff;
    --text-dark: #1f2937;
    --text-light: #9ca3af;
    --text-white: #f9fafb;

    --sidebar-width: 260px;
    --header-height: 70px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: 1px solid rgba(255, 255, 255, 0.3);
    --backdrop-blur: blur(12px);

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    overflow-x: hidden;
}

/* --- Layout Structure --- */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    padding-top: var(--header-height);
}

/* --- Floating Header --- */
.navbar-floating {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-bottom: var(--glass-border);
    box-shadow: var(--shadow-sm);
    z-index: 1030;
    padding: 0 1.5rem;
    transition: all var(--transition-normal);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary-color) !important;
    letter-spacing: -0.5px;
}

/* --- Sidebar --- */
#sidebar-wrapper {
    width: var(--sidebar-width);
    background-color: var(--dark-bg) !important;
    border-right: none;
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 1020;
    overflow-y: auto;
    transition: transform var(--transition-normal);
}

@media (max-width: 768px) {
    #sidebar-wrapper {
        transform: translateX(-100%);
    }

    #sidebar-wrapper.toggled {
        transform: translateX(0);
    }
}

.sidebar-heading {
    padding: 1.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    font-weight: 600;
}

.list-group-item {
    background: transparent !important;
    color: var(--text-light) !important;
    border: none !important;
    padding: 0.875rem 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent !important;
}

.list-group-item i {
    width: 24px;
    margin-right: 0.75rem;
    text-align: center;
    transition: transform var(--transition-fast);
}

.list-group-item:hover {
    color: var(--white) !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    transform: translateX(4px);
}

.list-group-item.active {
    color: var(--white) !important;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.15) 0%, transparent 100%) !important;
    border-left-color: var(--primary-color) !important;
}

.list-group-item.active i {
    color: var(--primary-color);
}

/* --- Main Content --- */
#page-content-wrapper {
    width: 100%;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin-left var(--transition-normal);
}

@media (max-width: 768px) {
    #page-content-wrapper {
        margin-left: 0;
        padding: 1rem;
    }
}

/* --- Cards & UI Elements --- */
.card {
    background: var(--white);
    border: none;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.card-body {
    padding: 1.5rem;
}

/* KPI Cards */
.kpi-card {
    color: white;
    position: relative;
    overflow: hidden;
}

.kpi-card.bg-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%) !important;
}

.kpi-card.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

.kpi-card .card-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.kpi-card .card-text {
    opacity: 0.9;
    font-size: 0.9rem;
}

.kpi-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    opacity: 0.15;
    transform: rotate(-15deg);
}

/* --- POS Modern Refinements --- */

/* Minimalist Product Card */
.product-card-minimal {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid transparent;
}

.product-card-minimal:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.product-card-minimal img {
    height: 140px;
    object-fit: cover;
    width: 100%;
    transition: transform 0.3s ease;
}

.product-card-minimal:hover img {
    transform: scale(1.05);
}

.product-card-minimal .card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.product-card-minimal .product-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.product-card-minimal .product-price {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.product-card-minimal .product-stock {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: auto;
}

/* Modern Cart */
.cart-panel-modern {
    background: white;
    border-left: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.05);
}

.cart-header {
    padding: 1.5rem;
    background: var(--white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-items-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-item-modern {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--light-bg);
    border-radius: 10px;
    transition: background 0.2s;
}

.cart-item-modern:hover {
    background: #eef2ff;
    /* Very light indigo */
}

.cart-item-info {
    flex-grow: 1;
    padding-right: 1rem;
}

.cart-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    display: block;
}

.cart-item-price {
    font-size: 0.8rem;
    color: var(--text-light);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-qty {
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.7rem;
}

.cart-footer-modern {
    padding: 1.5rem;
    background: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
}

/* Modern Modals */
.modal-modern .modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-modern .modal-header {
    background: linear-gradient(135deg, var(--primary-color), #4338ca);
    color: white;
    border-bottom: none;
    padding: 1.5rem;
}

.modal-modern .modal-title {
    font-weight: 700;
    font-size: 1.25rem;
}

.modal-modern .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-modern .modal-body {
    padding: 2rem;
}

.modal-modern .form-select,
.modal-modern .form-control {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
}

.modal-modern .form-select:focus,
.modal-modern .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Payment Method Cards */
.payment-method-card {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: white;
}

.payment-method-card:hover {
    border-color: var(--primary-color);
    background: #eef2ff;
    transform: translateY(-2px);
}

.payment-method-card.active {
    border-color: var(--primary-color);
    background: #eef2ff;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.payment-method-card i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.payment-method-card.active i {
    color: var(--primary-color);
}

.payment-method-card span {
    font-weight: 600;
    color: var(--text-dark);
}

/* Quick Cash Buttons */
.btn-quick-cash {
    border: 1px solid #e5e7eb;
    background: white;
    color: var(--text-dark);
    font-weight: 600;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-quick-cash:hover {
    background: var(--light-bg);
    border-color: var(--text-light);
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge-stock-alert {
    background-color: #ef4444;
    color: white;
    padding: 0.25em 0.6em;
    border-radius: 999px;
    font-size: 0.75rem;
}

.btn-toggle-sidebar {
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-size: 1.25rem;
    padding: 0.5rem;
    margin-right: 1rem;
    cursor: pointer;
}

@media (min-width: 769px) {
    .btn-toggle-sidebar {
        display: none;
    }
}

.avatar-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.dashed-border {
    background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='10' ry='10' stroke='%239CA3AF' stroke-width='2' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- PRINT STYLES (Thermal Receipt) --- */
@media print {
    body * {
        visibility: hidden;
    }

    #receiptModal,
    #receiptModal * {
        visibility: visible;
    }

    #receiptModal {
        position: absolute;
        left: 0;
        top: 0;
        margin: 0;
        padding: 0;
        width: 100%;
        height: auto;
        background: white !important;
        border: none !important;
    }

    .modal-dialog {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        transform: none !important;
    }

    .modal-content {
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .modal-body {
        padding: 0 !important;
    }

    #receipt-preview {
        width: 100%;
        max-width: 80mm;
        /* Standard thermal width */
        margin: 0 auto;
        padding: 10px !important;
        font-family: 'Courier New', Courier, monospace;
        font-size: 12px;
        color: black;
    }

    /* Hide non-printable elements in modal */
    .modal-footer,
    .modal-header,
    .btn-close {
        display: none !important;
    }

    /* Ensure text is black */
    .text-muted {
        color: black !important;
    }

    /* Remove borders/backgrounds that might look bad */
    .bg-light,
    .bg-white {
        background: none !important;
    }
}