:root {
    --primary-color: #ff6b6b;
    --primary-hover: #fa5252;
    --secondary-color: #4dabf7;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #343a40;
    --text-muted: #868e96;
    --border-color: #e9ecef;
    --success-color: #51cf66;
    --danger-color: #fa5252;
    --warning-color: #fcc419;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background-color: rgba(255, 107, 107, 0.05);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: rgba(255, 107, 107, 0.1);
    color: var(--primary-color);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

header {
    background-color: var(--card-bg);
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Utility Classes */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--bg-color);
}

/* POS Specific Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
    padding: 1.5rem;
    height: calc(100vh - 73px);
}

.menu-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Cards */
.menu-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 107, 107, 0.3);
}

.menu-img {
    width: 100%;
    height: 160px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background-color: #eee;
}

.menu-info {
    padding: 1.25rem;
}

.menu-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.menu-price {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.1rem;
}

.menu-stock {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Cart Section */
.cart-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color);
}

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

.cart-item-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-color);
    border-radius: var(--radius-full);
    padding: 0.25rem;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.cart-total-row.grand-total {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
    color: var(--primary-color);
}

/* Inventory Pages */
.page-container {
    padding: 2rem;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.table-container {
    overflow-x: auto;
}

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

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-color);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(81, 207, 102, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(252, 196, 25, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(250, 82, 82, 0.1);
    color: var(--danger-color);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Tablet Responsive Design (iPad Portrait) */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        width: 100px;
        padding: 1.5rem 0.5rem;
        align-items: center;
    }

    .logo {
        margin-bottom: 2rem;
        justify-content: center;
    }

    .sidebar .logo span {
        display: none !important;
    }

    .sidebar .logo img {
        margin-right: 0 !important;
        height: 35px !important;
    }

    .nav-link {
        flex-direction: column;
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
        text-align: center;
        gap: 0.5rem;
    }

    .nav-link svg {
        margin: 0;
    }

    .pos-layout {
        grid-template-columns: 1fr 300px;
        gap: 1.25rem;
        padding: 1.25rem;
    }

    .menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    /* Sidebar becomes Bottom Navigation */
    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-between;
        padding: 0.5rem 1rem;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 50;
        border-right: none;
        border-top: 1px solid var(--border-color);
        background-color: var(--card-bg);
    }

    .logo {
        display: none; /* Hide logo on mobile bottom bar */
    }

    .sidebar > div[style*="margin-top: auto"] {
        margin-top: 0 !important;
        display: flex;
        align-items: center;
    }

    .nav-menu {
        flex-direction: row;
        gap: 0;
        justify-content: space-around;
        width: 100%;
        margin: 0;
    }

    .nav-link {
        flex-direction: column;
        padding: 0.5rem;
        font-size: 0.75rem;
        gap: 0.25rem;
        border-radius: var(--radius-md);
        text-align: center;
    }

    .nav-link svg {
        width: 20px;
        height: 20px;
        margin: 0 auto;
    }

    /* Main Content */
    .main-content {
        margin-bottom: 70px; /* Space for bottom nav */
        height: calc(100vh - 70px);
    }

    header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    header > div {
        width: 100%;
    }

    /* POS Layout */
    .pos-layout {
        grid-template-columns: 1fr;
        height: auto;
        padding: 1rem;
        gap: 1rem;
    }

    .menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }
    
    .menu-info {
        padding: 0.85rem;
    }
    
    .menu-title {
        font-size: 0.95rem;
    }
    
    .menu-price {
        font-size: 1rem;
    }

    .cart-section {
        margin-top: 1rem;
        padding-bottom: 80px; /* Space for floating button */
    }

    /* Floating Cart Button (Mobile Only) */
    .floating-cart-btn {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%) translateY(100px);
        width: 90%;
        max-width: 400px;
        background: var(--primary-color);
        color: white;
        border-radius: var(--radius-full);
        padding: 1rem 1.5rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 10px 25px rgba(255, 107, 107, 0.4);
        z-index: 999;
        opacity: 0;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        cursor: pointer;
    }

    .floating-cart-btn.active {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }

    .floating-cart-btn:hover {
        background: var(--primary-hover);
        transform: translateX(-50%) translateY(-3px);
    }

    .floating-cart-icon-wrapper {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        font-weight: 600;
        font-size: 1.05rem;
    }

    .floating-cart-badge {
        background: white;
        color: var(--primary-color);
        width: 24px;
        height: 24px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        font-weight: bold;
    }

    /* Modals */
    .modal {
        width: 95%;
        margin: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column;
        padding: 1rem;
    }

    .modal-footer > button {
        width: 100%;
    }

    /* Pages & Cards */
    .page-container {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    /* Header action bars inside cards */
    .card > div[style*="display: flex"] {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }
    
    .card > div[style*="display: flex"] > div {
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 100%;
    }
    
    .card > div[style*="display: flex"] > div > * {
        flex: 1 1 auto;
    }
}

/* Utils */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-menu {
    position: absolute;
    top: 110%;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.profile-menu button {
    width: 100%;
    text-align: left;
    padding: 0.85rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-menu button:last-child {
    border-bottom: none;
}

.profile-menu button:hover {
    background: var(--bg-color);
    color: var(--primary-color);
    padding-left: 1.5rem;
}

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