/* ============================================
   Warung Mie Management System - Stylesheet
   ============================================ */

/* CSS Variables */
:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --primary-light: #ff6b5a;
    --secondary: #34495e;
    --secondary-dark: #2c3e50;
    --success: #27ae60;
    --success-dark: #1e8449;
    --warning: #f39c12;
    --danger: #e74c3c;
    --danger-dark: #c0392b;
    --info: #3498db;
    --bg-main: #f5f6fa;
    --bg-card: #ffffff;
    --bg-sidebar: #2c3e50;
    --bg-sidebar-hover: #34495e;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-light: #bdc3c7;
    --text-white: #ecf0f1;
    --border: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 5px 30px rgba(0,0,0,0.15);
    --radius: 10px;
    --radius-sm: 6px;
    --sidebar-width: 240px;
    --transition: all 0.2s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* ============ SIDEBAR ============ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: 2px 0 15px rgba(0,0,0,0.2);
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
    font-size: 42px;
    margin-bottom: 8px;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.sidebar-header .subtitle {
    color: var(--text-light);
    font-size: 12px;
}

.nav-menu {
    list-style: none;
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    gap: 12px;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
}

.nav-item.active {
    background: var(--bg-sidebar-hover);
    border-left-color: var(--primary);
}

.nav-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 24px 32px;
    min-height: 100vh;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ PAGE HEADER ============ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============ BUTTONS ============ */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-toggle {
    padding: 10px 20px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-toggle:hover {
    border-color: var(--primary);
}

.btn-toggle.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ============ BADGES ============ */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-dinein {
    background: #3498db22;
    color: var(--info);
    border: 1px solid var(--info);
}

.badge-takeaway {
    background: #f39c1222;
    color: var(--warning);
    border: 1px solid var(--warning);
}

.badge-active {
    background: #27ae6022;
    color: var(--success);
    border: 1px solid var(--success);
}

.badge-inactive {
    background: #e74c3c22;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.badge-warning {
    background: #f39c1222;
    color: var(--warning);
    border: 1px solid var(--warning);
}

.badge-danger {
    background: #e74c3c22;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.badge-ok {
    background: #27ae6022;
    color: var(--success);
    border: 1px solid var(--success);
}

/* ============ FORMS ============ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(231,76,60,0.1);
}

.form-group-row {
    display: flex;
    gap: 16px;
}

.form-group-row .form-group {
    flex: 1;
}

.input-small {
    width: 70px !important;
    padding: 6px 10px !important;
    text-align: center;
    font-weight: 600;
}

.input-medium {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

/* ============ TABLES ============ */
.table-container {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

.data-table th {
    background: var(--secondary);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .price {
    font-weight: 600;
    color: var(--success);
}

/* ============ POS LAYOUT ============ */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    height: calc(100vh - 140px);
}

.pos-menu-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    background: var(--bg-card);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(231,76,60,0.1);
}

.category-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cat-btn {
    padding: 8px 16px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.cat-btn:hover {
    border-color: var(--primary);
}

.cat-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding-right: 8px;
    flex: 1;
}

.menu-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.menu-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.menu-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-card-icon {
    font-size: 36px;
}

.menu-card-name {
    font-weight: 600;
    font-size: 14px;
}

.menu-card-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
}

/* Order Section */
.pos-order-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 140px);
}

.order-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-header h3 {
    font-size: 16px;
}

.order-info {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.order-info label {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
    min-height: 200px;
}

.empty-order {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-order p {
    font-size: 16px;
    margin-bottom: 4px;
}

.order-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
}

.order-item:last-child {
    border-bottom: none;
}

.order-item-info {
    flex: 1;
}

.order-item-name {
    font-weight: 600;
    font-size: 14px;
}

.order-item-note {
    font-size: 12px;
    color: var(--text-secondary);
}

.order-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-item-qty button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.order-item-qty button:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.order-item-qty span {
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.order-item-price {
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.order-item-remove {
    cursor: pointer;
    color: var(--danger);
    font-size: 18px;
    padding: 4px;
}

.order-footer {
    border-top: 2px solid var(--border);
    padding: 16px 20px;
}

.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.order-total span:last-child {
    color: var(--primary);
    font-size: 24px;
}

.order-actions {
    display: flex;
    gap: 12px;
}

.order-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 12px;
}

/* ============ MENU MANAGEMENT ============ */
.menu-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab {
    padding: 8px 20px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.tab:hover {
    border-color: var(--primary);
}

.tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.section-divider {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 32px 0 16px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

.section-divider h3 {
    font-size: 18px;
}

.category-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.category-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.category-tag .cat-delete {
    cursor: pointer;
    color: var(--danger);
    font-size: 16px;
    margin-left: 4px;
}

.category-tag .cat-edit {
    cursor: pointer;
    color: var(--info);
    font-size: 14px;
}

/* ============ STOCK MANAGEMENT ============ */
.stock-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stock-alerts {
    margin-bottom: 20px;
}

.stock-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 14px;
}

.stock-alert.critical {
    background: #f8d7da;
    border-color: var(--danger);
}

.stock-alert-icon {
    font-size: 24px;
}

/* ============ REPORTS ============ */
.report-date-picker {
    display: flex;
    gap: 8px;
    align-items: center;
}

.report-date-picker input {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.report-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

.report-card-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.report-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.report-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.report-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.report-section h3 {
    margin-bottom: 16px;
    font-size: 16px;
}

.report-actions {
    text-align: center;
    margin-top: 24px;
}

/* ============ SETTINGS ============ */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.settings-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.settings-card h3 {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.settings-desc {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 14px;
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-actions .btn {
    justify-content: center;
}

/* ============ MODALS ============ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.15s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-small {
    max-width: 400px;
}

.modal-receipt {
    max-width: 360px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 4px;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ============ PAYMENT MODAL ============ */
.payment-summary {
    text-align: center;
    margin-bottom: 24px;
}

.payment-total {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.payment-total span:first-child {
    font-size: 14px;
    color: var(--text-secondary);
}

.total-big {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.payment-methods {
    margin-bottom: 20px;
}

.payment-methods h4 {
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.payment-method-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.payment-method-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.payment-method-btn:hover {
    border-color: var(--primary);
}

.payment-method-btn.active {
    border-color: var(--primary);
    background: rgba(231,76,60,0.05);
}

.pm-icon {
    font-size: 24px;
}

.pm-name {
    font-size: 12px;
    font-weight: 600;
}

.cash-input-section {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.quick-cash {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.quick-cash-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.quick-cash-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.change-amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-size: 16px;
    font-weight: 700;
}

.change-big {
    color: var(--success);
    font-size: 24px;
}

/* ============ RECEIPT ============ */
.receipt-content {
    background: #fff;
    border: 1px dashed #ccc;
    padding: 24px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
}

/* Print-only receipt (80mm thermal) */
#print-area {
    display: none;
}

.receipt-header {
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #ccc;
}

.receipt-header h4 {
    font-size: 16px;
    font-weight: 700;
}

.receipt-line {
    display: flex;
    justify-content: space-between;
}

.receipt-divider {
    text-align: center;
    margin: 8px 0;
    color: #999;
}

.receipt-total {
    font-weight: 700;
    font-size: 15px;
    border-top: 1px dashed #ccc;
    padding-top: 8px;
    margin-top: 8px;
}

/* ============ RECIPE ============ */
.recipe-menu-info {
    background: var(--bg-main);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recipe-menu-info h4 {
    font-size: 18px;
}

.recipe-menu-info .recipe-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 18px;
}

.recipe-items-list {
    margin-bottom: 16px;
    max-height: 250px;
    overflow-y: auto;
}

.recipe-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    gap: 12px;
    background: #fff;
}

.recipe-item-info {
    flex: 1;
}

.recipe-item-name {
    font-weight: 600;
    font-size: 14px;
}

.recipe-item-qty {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
}

.recipe-item-delete {
    cursor: pointer;
    color: var(--danger);
    font-size: 16px;
    padding: 4px;
}

.recipe-add-form {
    border-top: 2px solid var(--border);
    padding-top: 16px;
}

.recipe-add-form h4 {
    margin-bottom: 12px;
    font-size: 14px;
}

.recipe-quick-add {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.recipe-quick-add .recipe-qty-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
}

.recipe-quick-add .recipe-qty-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.recipe-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #27ae6022;
    color: var(--success);
    border: 1px solid var(--success);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.recipe-badge-empty {
    background: #f39c1222;
    color: var(--warning);
    border-color: var(--warning);
}

.recipe-info-box {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #1e40af;
}

.recipe-shortage {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}

/* ============ LOG FILTERS ============ */
.log-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.log-filters .input-filter {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--foreground);
    font-size: 13px;
    min-width: 150px;
}

.log-total {
    margin-left: auto;
    font-size: 13px;
    color: var(--muted-foreground);
}

.stock-warning-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============ EXPENSES ============ */
.expense-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.expense-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ============ ORDERS / PESANAN ============ */
.order-info-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 6px;
}

.order-info-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.input-medium-text {
    padding: 6px 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    width: 140px;
}

.input-small-select {
    padding: 6px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.orders-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.orders-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #e67e22;
}

@media (max-width: 768px) {
    .expense-filters,
    .orders-filters {
        flex-direction: column;
    }
    .expense-filters .input-medium,
    .orders-filters .input-medium {
        width: 100%;
    }
    .expense-summary,
    .orders-summary {
        grid-template-columns: 1fr 1fr;
    }
    .order-info-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .input-medium-text {
        width: 100%;
    }
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============ UTILITIES ============ */
.bold { font-weight: 700; }
.text-muted { color: var(--text-secondary); font-size: 13px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ============ LOGIN PAGE ============ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg) 0%, var(--card) 100%);
    padding: 20px;
}

.login-container {
    background: var(--card);
    border-radius: var(--radius);
    padding: 40px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    text-align: center;
}

.login-logo {
    font-size: 64px;
    margin-bottom: 8px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
}

.login-subtitle {
    font-size: 14px;
    color: var(--muted-foreground);
    margin: 4px 0 24px 0;
}

.login-form {
    text-align: left;
}

.login-field {
    margin-bottom: 16px;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--foreground);
    font-size: 14px;
    box-sizing: border-box;
}

.login-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}

.login-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 12px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
}

/* ============ SIDEBAR USER INFO ============ */
.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--muted-foreground);
}

.btn-logout {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
}

/* ============ BADGES ============ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.badge-info {
    background: #dbeafe;
    color: #2563eb;
}

.badge-success {
    background: #d1fae5;
    color: #059669;
}

.badge-warning {
    background: #fef3c7;
    color: #d97706;
}

/* ============ PRINT STYLES (THERMAL 80mm) ============ */
#print-area {
    display: none !important;
}

@media print {
    @page {
        size: 58mm auto;
        margin: 0;
    }

    html, body {
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        background: white !important;
        width: 58mm !important;
    }

    /* ANIHILATE everything */
    body * {
        visibility: hidden !important;
        display: none !important;
        position: absolute !important;
        left: -9999px !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Only show print-area */
    #print-area,
    #print-area * {
        visibility: visible !important;
        display: block !important;
        position: relative !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
    }

    #print-area {
        width: 54mm !important;
        margin: 0 !important;
        padding: 1mm 2mm !important;
        font-family: Arial, Helvetica, sans-serif !important;
        font-size: 9pt !important;
        font-weight: 700 !important;
        line-height: 1.3 !important;
        color: #000 !important;
        background: white !important;
        word-wrap: break-word !important;
        -webkit-font-smoothing: none !important;
    }

    #print-area .receipt-header {
        text-align: center !important;
        margin-bottom: 1mm !important;
        border-bottom: 2px solid #000 !important;
        padding-bottom: 1mm !important;
    }

    #print-area .receipt-header h4 {
        font-size: 11pt !important;
        font-weight: 800 !important;
        margin: 0 0 0.5mm 0 !important;
        letter-spacing: 0.3pt !important;
    }

    #print-area .receipt-header p {
        margin: 0 !important;
        font-size: 7pt !important;
        font-weight: 700 !important;
    }

    #print-area .receipt-line {
        display: flex !important;
        justify-content: space-between !important;
        margin: 0.3mm 0 !important;
        font-size: 8pt !important;
        font-weight: 700 !important;
    }

    #print-area .receipt-line span:first-child {
        flex: 1 !important;
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    #print-area .receipt-line span:last-child {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        padding-left: 1mm !important;
    }

    #print-area .receipt-divider {
        text-align: center !important;
        margin: 1mm 0 !important;
        font-size: 0 !important;
        font-weight: 800 !important;
        letter-spacing: 0 !important;
        border-top: 2px solid #000 !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    #print-area .receipt-total {
        font-weight: 800 !important;
        border-top: 2px solid #000 !important;
        padding-top: 1mm !important;
        margin-top: 1mm !important;
        font-size: 10pt !important;
    }

    #print-area .receipt-footer-text {
        font-size: 7pt !important;
        font-weight: 700 !important;
        text-align: center !important;
        white-space: pre-line !important;
    }

    #print-area .receipt-unpaid {
        text-align: center !important;
        margin: 2mm 0 !important;
        padding: 1.5mm !important;
        border: 2px solid #000 !important;
        font-weight: 900 !important;
        font-size: 10pt !important;
        letter-spacing: 0.5pt !important;
    }
}

/* ============ RESPONSIVE ============ */

/* Hamburger menu button (hidden on desktop) */
.hamburger {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    background: var(--bg-sidebar);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    box-shadow: var(--shadow);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.active {
        display: block;
    }
    .hamburger {
        display: flex;
    }
    .main-content {
        margin-left: 0;
        padding: 20px 16px;
        padding-top: 70px;
    }
    .pos-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .pos-order-section {
        max-height: none;
        position: sticky;
        bottom: 0;
    }
    .menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .main-content {
        padding: 12px;
        padding-top: 64px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    /* POS - single column, stacked */
    .pos-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .pos-menu-section {
        order: 1;
    }

    .pos-order-section {
        order: 2;
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }

    /* Menu grid - 2 columns on mobile */
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .menu-card {
        padding: 12px 8px;
    }

    .menu-card-icon {
        font-size: 28px;
    }

    .menu-card-name {
        font-size: 13px;
    }

    .menu-card-price {
        font-size: 14px;
    }

    /* Category filter - scroll horizontal */
    .category-filter {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .cat-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Search bar */
    .search-bar input {
        font-size: 14px;
        padding: 10px 12px;
    }

    /* Order items */
    .order-header {
        padding: 12px 14px;
    }

    .order-info {
        padding: 8px 14px;
    }

    .order-items {
        padding: 10px 14px;
        min-height: 120px;
    }

    .order-item {
        gap: 8px;
        padding: 8px 0;
    }

    .order-item-name {
        font-size: 13px;
    }

    .order-item-qty button {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .order-footer {
        padding: 12px 14px;
    }

    .order-total {
        font-size: 16px;
    }

    .order-total span:last-child {
        font-size: 20px;
    }

    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .btn-toggle {
        padding: 8px 14px;
        font-size: 13px;
    }

    /* Tables - horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Modals - nearly full screen on mobile */
    .modal {
        padding: 8px;
        align-items: flex-end;
    }

    .modal-content {
        max-height: 85vh;
        border-radius: var(--radius) var(--radius) 0 0;
        animation: slideUp 0.25s ease;
    }

    .modal-receipt {
        max-width: 100%;
    }

    .modal-small {
        max-width: 100%;
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1;
        justify-content: center;
        min-width: 100px;
    }

    /* Payment modal */
    .total-big {
        font-size: 26px;
    }

    .payment-method-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .payment-method-btn {
        padding: 10px 6px;
    }

    .pm-icon {
        font-size: 20px;
    }

    .pm-name {
        font-size: 11px;
    }

    /* Quick cash buttons */
    .quick-cash {
        gap: 6px;
    }

    .quick-cash-btn {
        padding: 8px 10px;
        font-size: 11px;
    }

    /* Reports */
    .report-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .report-card {
        padding: 16px;
    }

    .report-card-value {
        font-size: 20px;
    }

    .report-card-icon {
        font-size: 24px;
    }

    .report-date-picker {
        width: 100%;
    }

    .report-date-picker input {
        flex: 1;
    }

    .report-section {
        padding: 16px;
        overflow-x: auto;
    }

    .report-section .data-table {
        min-width: 400px;
    }

    /* Menu tabs */
    .menu-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Category tags */
    .category-list {
        gap: 8px;
    }

    .category-tag {
        font-size: 13px;
        padding: 6px 12px;
    }

    /* Stock page */
    .stock-filters {
        flex-direction: column;
    }

    .stock-filters .input-medium {
        width: 100%;
    }

    .stock-alert {
        font-size: 13px;
        padding: 10px 12px;
    }

    /* Settings */
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-card {
        padding: 16px;
    }

    /* Form rows */
    .form-group-row {
        flex-direction: column;
        gap: 0;
    }

    /* Input small (table number) */
    .input-small {
        width: 60px !important;
    }

    /* Order type toggle */
    .order-type-toggle {
        width: 100%;
    }

    .order-type-toggle .btn-toggle {
        flex: 1;
    }
}

/* Small phone (max-width: 480px) */
@media (max-width: 480px) {
    .main-content {
        padding: 8px;
        padding-top: 60px;
    }

    .page-header h1 {
        font-size: 18px;
    }

    /* POS - menu grid tighter */
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .menu-card {
        padding: 10px 6px;
    }

    .menu-card-icon {
        font-size: 24px;
    }

    .menu-card-name {
        font-size: 12px;
    }

    .menu-card-price {
        font-size: 13px;
    }

    /* Payment */
    .payment-method-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Report cards */
    .report-summary {
        grid-template-columns: 1fr 1fr;
    }

    .report-card-value {
        font-size: 18px;
    }

    /* Receipt content */
    .receipt-content {
        font-size: 12px;
        padding: 16px;
    }
}
