/* Root Variables */

:root {
    --primary: #8B4513;
    --primary-dark: #5a2a0c;
    --primary-light: #d2691e;
    --secondary: #ffd700;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --dark: #2c3e2f;
    --light: #fff9f0;
    --gray: #f5f5f5;
    --border: #e0d6c8;
    --text: #2d2418;
}


/* Dark Mode Variables */

.dark-mode {
    --primary: #d2691e;
    --light: #1a1a1a;
    --border: #3d3d3d;
    --gray: #2d2d2d;
    --text: #ffffff;
    --dark: #ffffff;
}


/* Reset & Base Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #fef7e8 0%, #fff5e6 100%);
    color: var(--text);
    overflow-x: hidden;
    transition: all 0.3s ease;
}

.dark-mode body {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}


/* App Container */

.app-wrapper {
    max-width: 500px;
    margin: 0 auto;
    background: var(--light);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    transition: background 0.3s;
}


/* Login Screen */

.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #8B4513, #5a2a0c);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.4s;
}

.login-card {
    background: white;
    border-radius: 2rem;
    padding: 2rem 1.5rem;
    width: 90%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.login-logo i {
    font-size: 3rem;
    color: white;
}

.login-card h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-card input {
    width: 100%;
    padding: 14px;
    margin: 10px 0;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s;
}

.login-card input:focus {
    outline: none;
    border-color: var(--primary);
}

.login-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    padding: 14px;
    width: 100%;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s;
}

.login-btn:active {
    transform: scale(0.98);
}


/* Main App */

.main-app {
    display: none;
    position: relative;
}


/* Header */

.app-header {
    background: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.dark-mode .app-header {
    background: #2d2d2d;
}

.logo-area h1 {
    font-size: 1.3rem;
    color: var(--primary);
}

.logo-area p {
    font-size: 0.7rem;
    color: #7f5e3a;
}

.dark-mode .logo-area p {
    color: #aaa;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: var(--gray);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
}

.icon-btn:active {
    transform: scale(0.95);
}


/* Bottom Navigation */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 16px;
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.dark-mode .bottom-nav {
    background: #2d2d2d;
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    background: none;
    border: none;
    font-size: 0.7rem;
    color: #7f5e3a;
    transition: all 0.2s;
    cursor: pointer;
    border-radius: 50px;
}

.nav-item i {
    font-size: 1.4rem;
    display: block;
    margin-bottom: 4px;
}

.nav-item.active {
    color: var(--primary);
    background: rgba(139, 69, 19, 0.1);
}


/* Content Area */

.content-area {
    padding: 1rem;
    padding-bottom: 80px;
    margin-bottom: 60px;
}

.screen {
    display: none;
    animation: slideIn 0.3s;
}

.screen.active-screen {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}


/* Dashboard Cards */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.dark-mode .stat-card {
    background: #2d2d2d;
}

.stat-card h3 {
    font-size: 0.75rem;
    color: #7f5e3a;
    margin-bottom: 0.5rem;
}

.dark-mode .stat-card h3 {
    color: #aaa;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}


/* Chart Container */

.chart-container {
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.dark-mode .chart-container {
    background: #2d2d2d;
}


/* POS Grid */

.search-bar {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 1rem;
    margin-bottom: 1rem;
    background: white;
    color: var(--text);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    max-height: 450px;
    overflow-y: auto;
}

.product-item {
    background: white;
    border-radius: 1rem;
    padding: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.dark-mode .product-item {
    background: #2d2d2d;
}

.product-item:active {
    transform: scale(0.97);
    background: #fff5e6;
}

.product-name {
    font-weight: bold;
    font-size: 0.9rem;
}

.product-price {
    color: var(--primary);
    font-size: 0.85rem;
    margin-top: 4px;
}

.product-stock {
    font-size: 0.7rem;
    color: #7f5e3a;
}


/* Cart Modal */

.cart-modal {
    display: none;
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: 1.5rem 1.5rem 0 0;
    max-height: 75vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s;
}

.dark-mode .cart-modal {
    background: #2d2d2d;
}

.cart-modal.active {
    display: block;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.cart-header {
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-radius: 1.5rem 1.5rem 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    background: var(--gray);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-btn:active {
    transform: scale(0.95);
}


/* Tables */

.data-table {
    width: 100%;
    background: white;
    border-radius: 1rem;
    overflow-x: auto;
    margin-top: 1rem;
}

.dark-mode .data-table {
    background: #2d2d2d;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--gray);
    font-weight: bold;
}


/* Buttons */

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
    transition: transform 0.2s;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--gray);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

.btn-secondary:active {
    transform: scale(0.98);
}


/* Alerts */

.alert-warning {
    background: #fff3e0;
    border-left: 4px solid var(--warning);
    padding: 0.8rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.dark-mode .alert-warning {
    background: #3d2a1a;
}


/* Toast Notification */

.toast-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    z-index: 2000;
    animation: fadeInOut 3s;
    max-width: 80%;
    text-align: center;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        bottom: 80px;
    }
    10% {
        opacity: 1;
        bottom: 100px;
    }
    90% {
        opacity: 1;
        bottom: 100px;
    }
    100% {
        opacity: 0;
        bottom: 80px;
    }
}


/* Barcode Scanner */

.barcode-scanner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: black;
    z-index: 1500;
    display: none;
}

.barcode-scanner.active {
    display: block;
}


/* Responsive */

@media (max-width: 480px) {
    .stats-grid {
        gap: 0.5rem;
    }
    .product-grid {
        gap: 0.5rem;
    }
    .stat-value {
        font-size: 1.2rem;
    }
    .btn-primary,
    .btn-secondary {
        padding: 10px 16px;
    }
}


/* Scrollbar */

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--gray);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}