/* ============================================================
   GLOBAL STYLES
   ============================================================ */

:root {
    --primary: #0f766e;
    --primary-dark: #115e59;
    --secondary: #5f6b7a;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #115e59;
    --light: #f7f5ee;
    --dark: #1f2937;
    --border: #e4dccf;
    --surface: #fffdf8;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    font-size: 14px;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar.hidden {
    transform: translateX(-100%);
}

.main-content {
    margin-left: 260px;
    min-height: 100vh;
    padding: 20px;
    transition: margin-left 0.3s ease;
    position: relative;
}

.main-content.sidebar-hidden {
    margin-left: 0;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 2px solid var(--light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h2 {
    font-size: 20px;
    color: var(--primary);
    font-weight: 700;
    margin: auto;
    position: relative;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 8px;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--dark);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    gap: 12px;
    font-weight: 500;
    position: relative;
}

.sidebar-menu a:hover {
    background: var(--light);
    color: var(--primary);
    transform: translateX(4px);
}

.sidebar-menu a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.3);
}

.sidebar-menu a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: white;
    border-radius: 0 2px 2px 0;
}

.sidebar-menu .icon {
    width: 24px;
    text-align: center;
    font-size: 18px;
}


.user-info {
    padding: 18px 20px;
    border-top: 2px solid var(--light);
    margin-top: auto;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.08) 0%, rgba(245, 158, 11, 0.08) 100%);
    border-radius: 8px;
    margin: 20px 10px 0;
}

.user-info .name {
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--dark);
    font-size: 14px;
}

.user-info .role {
    font-size: 12px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 0;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: rgba(15, 118, 110, 0.14); color: var(--info); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.orange { background: #fed7aa; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }

.stat-info h4 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--secondary);
    font-size: 13px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--dark);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

thead {
    background: var(--light);
}

th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--secondary);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: var(--light);
}

.table-actions {
    display: flex;
    gap: 8px;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fed7aa;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: rgba(15, 118, 110, 0.14);
    color: #0f4f4a;
}

/* ============================================================
   MODAL
   ============================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--secondary);
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: #fed7aa;
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: rgba(15, 118, 110, 0.14);
    color: #0f4f4a;
    border-left: 4px solid var(--info);
}

/* ============================================================
   POS SPECIFIC
   ============================================================ */

.pos-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    height: calc(100vh - 40px);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    height: fit-content;
}

.product-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.product-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.product-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.product-card h4 {
    font-size: 14px;
    margin-bottom: 5px;
}

.product-card .price {
    color: var(--primary);
    font-weight: 600;
}

.cart-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.cart-total {
    padding-top: 20px;
    border-top: 2px solid var(--border);
    margin-top: auto;
}

.cart-total h3 {
    font-size: 24px;
    margin-bottom: 20px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--primary);
}

.login-header p {
    color: var(--secondary);
}

/* ============================================================
   CHARTS
   ============================================================ */

.chart-container {
    position: relative;
    height: 300px;
}

.card-body canvas {
    display: block;
    width: 100%;
    max-width: 100%;
}

/* ============================================================
   UTILITIES
   ============================================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-secondary { color: var(--secondary); }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

/* ============================================================
   HAMBURGER MENU
   ============================================================ */

.hamburger-menu {
    display: flex;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    background: var(--primary);
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.3);
    gap: 6px;
}

.hamburger-menu:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.4);
    transform: translateY(-2px);
}

.hamburger-menu:active {
    transform: translateY(0);
}

.hamburger-line {
    display: block;
    width: 26px;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-origin: center;
}

.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .sidebar.hidden {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .main-content.sidebar-hidden {
        margin-left: 0;
    }

    .pos-layout {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .sidebar,
    .btn,
    .card-header .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
