/* Minimalist Cashier App Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #f9fafb;
    --bg-card: #F5F5F5;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --accent: #0f172a;
    --accent-hover: #1e293b;
    --accent-light: #f1f5f9;
    --success: #0f172a;
    /* Keeping it minimalist by using black/dark gray even for success, or very dark forest green */
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.sidebar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.sidebar-item a:hover {
    background-color: var(--accent-light);
    color: var(--text-primary);
}

.sidebar-item.active a {
    background-color: var(--accent);
    color: #ffffff;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--danger);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background-color: var(--danger-light);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Prevent flex children from overflowing */
}

.header {
    height: 70px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--accent-light);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.content-body {
    padding: 32px;
    flex-grow: 1;
    overflow-y: auto;
}

/* Cards & Widgets */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Dashboard Widgets Grid */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.widget {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.widget-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background-color: var(--accent-light);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.widget-data {
    display: flex;
    flex-direction: column;
}

.widget-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.widget-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    background-color: var(--bg-card);
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--accent);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: var(--accent-light);
    color: var(--text-primary);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    padding: 14px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-primary);
}

.table td {
    padding: 14px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: #fafbfc;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
}

.badge-neutral {
    background-color: var(--accent-light);
    color: var(--text-primary);
}

.badge-success {
    background-color: #e6f4ea;
    color: #137333;
}

/* POS Screen Specifics */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    height: 100vh;
    overflow: hidden;
}

.pos-products-area {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    background-color: #fcfdfe;
    border-right: 1px solid var(--border-color);
}

.pos-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    flex-shrink: 0;
}

.pos-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pos-search-bar {
    width: 320px;
}

.pos-categories-nav {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.category-tab {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-tab:hover {
    background-color: var(--accent-light);
}

.category-tab.active {
    background-color: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.pos-products-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    align-content: start;
    gap: 16px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.product-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: var(--shadow-sm);
}

.product-card:hover {
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}

.product-code-badge {
    align-self: flex-start;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.product-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    flex-grow: 1;
}

.product-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 8px;
}

.product-stock {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* POS Cart / Sidebar Area */
.pos-cart-area {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    overflow: hidden;
    background-color: var(--bg-card);
}

.cart-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.cart-items-count {
    font-size: 0.75rem;
    background-color: var(--accent-light);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.cart-items-list {
    flex: 1 1 auto;
    min-height: 180px;
    overflow-y: auto;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    transition: border-color 0.2s ease;
}

.cart-item:hover {
    border-color: #cbd5e1;
}

.cart-item-details {
    flex-grow: 1;
    margin-right: 10px;
}

.cart-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
}

.cart-item-price {
    font-size: 0.775rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.cart-item-qty-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background-color: var(--accent-light);
    color: var(--text-primary);
}

.qty-val {
    font-size: 0.875rem;
    font-weight: 600;
    width: 22px;
    text-align: center;
}

.cart-item-total {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    width: 85px;
    text-align: right;
}

.cart-summary {
    border-top: 1px solid var(--border-color);
    padding: 14px 20px;
    background-color: #fafbfc;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    max-height: 50vh;
    overflow-y: auto;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.summary-row.total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    margin-top: 4px;
}

.checkout-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Modal dialogs */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 16px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

/* Login Page Specific Layout */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-primary);
    padding: 20px;
}

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-sm);
}

.login-brand {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    text-align: center;
}

/* Error text list */
.error-list {
    background-color: var(--danger-light);
    border: 1px solid #fca5a5;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    list-style: none;
}

.error-item {
    font-size: 0.8rem;
    color: var(--danger);
    font-weight: 500;
}

/* Report Filter Responsive Layout */
.report-filter-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

.report-filter-inputs {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

.report-filter-inputs .filter-group {
    margin-bottom: 0;
}

.report-filter-inputs .filter-group-type {
    width: 150px;
}

.report-filter-inputs .filter-group-outlet {
    width: 150px;
}

.report-filter-inputs .filter-group-daily {
    width: 180px;
}

.report-filter-inputs .filter-group-monthly {
    width: 150px;
}

.report-filter-inputs .filter-group-year {
    width: 120px;
}

.report-filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.report-filter-actions .btn-submit-filter,
.report-filter-actions .btn-export-filter {
    white-space: nowrap;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Tablet & Medium Screens Adjustment */
@media (max-width: 1200px) {
    .report-filter-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .report-filter-actions {
        margin-top: 4px;
    }
}

/* Mobile Screens Adjustment */
@media (max-width: 640px) {
    .report-filter-wrapper,
    .report-filter-inputs {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .report-filter-inputs .filter-group-type,
    .report-filter-inputs .filter-group-outlet,
    .report-filter-inputs .filter-group-daily,
    .report-filter-inputs .filter-group-monthly,
    .report-filter-inputs .filter-group-year {
        width: 100%;
    }

    .report-filter-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .report-filter-actions .btn-submit-filter,
    .report-filter-actions .btn-export-filter {
        width: 100%;
    }
}

/* Receipt Print layout */
@media print {
    @page {
        margin: 0;
        size: auto;
    }

    html,
    body {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body * {
        visibility: hidden !important;
    }

    .modal-overlay,
    .modal-container,
    .modal-body,
    .receipt-wrapper {
        position: static !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
        background: transparent !important;
        transform: none !important;
    }

    .receipt-wrapper,
    #thermal-receipt,
    #thermal-receipt * {
        visibility: visible !important;
    }

    #thermal-receipt {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 80mm !important;
        margin: 0 !important;
        padding: 5mm !important;
        box-shadow: none !important;
        border: none !important;
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
        background: #ffffff !important;
        color: #000000 !important;
        page-break-inside: auto;
    }
}

.receipt-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

.thermal-receipt {
    width: 80mm;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: #000000;
    box-shadow: var(--shadow-sm);
}

.thermal-header {
    text-align: center;
    margin-bottom: 15px;
}

.thermal-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
}

.thermal-divider {
    border-top: 1px dashed #000000;
    margin: 8px 0;
}

.thermal-info {
    margin-bottom: 10px;
}

.thermal-row {
    display: flex;
    justify-content: space-between;
}

.thermal-items {
    margin-bottom: 15px;
}

.thermal-item {
    margin-bottom: 8px;
}

.thermal-totals {
    margin-top: 10px;
}

.thermal-totals .thermal-row {
    font-weight: 700;
}

.thermal-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.75rem;
}

/* POS Toast Notification */
.pos-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    width: 100%;
    pointer-events: none;
}

.pos-toast {
    pointer-events: auto;
    background: #ffffff;
    border-left: 4px solid #3b82f6;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s ease;
}

.pos-toast.qr-order {
    border-left-color: #10b981;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.pos-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.pos-toast-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pos-toast-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.pos-toast-close:hover {
    color: #475569;
}

.pos-toast-body {
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.4;
}

.pos-toast-footer {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}