/* EMERGENCY RESET & STYLE V3 */

:root {
    --primary: #0f172a;
    /* Dark Navy - Corporate */
    --primary-light: #334155;
    --accent: #2563eb;
    /* Action Blue */

    --bg-body: #ebecf0;
    /* Darker Concrete to make white cards pop */
    --bg-white: #ffffff;

    --text-dark: #1e293b;
    /* Slate 800 */
    --text-gray: #64748b;
    /* Slate 500 */

    --border: #cbd5e1;
    /* Darker border */

    --h-height: 64px;
}

/* HARD RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-body) !important;
    background-image: none !important;
    /* KILL GRADIENTS */
    color: var(--text-dark);
    font-size: 14px;
    height: 100vh;
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* LAYOUT */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* TOP HEADER */
.top-nav {
    height: var(--h-height);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-icon {
    width: auto;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-icon img {
    height: 36px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    display: block;
}

.brand-name {
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.menu {
    display: flex;
    height: 100%;
}

.menu-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.menu-link {
    padding: 0 1.25rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #cbd5e1;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}

.menu-link:hover,
.menu-item.active .menu-link {
    background: var(--primary-light);
    color: white;
}

/* DROPDOWNS */
.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 240px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    padding: 0.5rem 0;
}

.menu-item.is-open .dropdown {
    display: flex;
}

.drop-link {
    padding: 0.75rem 1rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.drop-link:hover {
    background: #f1f5f9;
    color: var(--accent);
}

.drop-link i {
    color: var(--text-gray);
    width: 20px;
    text-align: center;
}

/* MAIN CONTENT */
.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    width: 100%;
}

/* COMPONENTS */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    /* Better Shadow */
}

/* Table Header Upgrade */
th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

tr:hover td {
    background-color: #f8fafc;
}

.title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.subtitle {
    color: #64748b;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    gap: 8px;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-secondary {
    background: white;
    border-color: var(--border);
    color: var(--text-dark);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-success {
    background: #10b981;
    color: white;
}

/* FORM */
.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    transition: border 0.2s;
}

.form-control:focus {
    border-color: var(--accent);
}

/* GRID SYSTEM */
.grid {
    display: grid;
    gap: 1.5rem;
}

.col-2 {
    grid-template-columns: 1fr 1fr;
}

.col-3 {
    grid-template-columns: repeat(3, 1fr);
}

.col-pos {
    grid-template-columns: 320px 1fr;
}

/* POS SPECIFIC */
.pos-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 100px);
    /* Adjust for header + padding */
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.product-card {
    border: 1px solid var(--border);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.p-img-box {
    height: 100px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* UTILS */
.text-right {
    text-align: right;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* LOGOUT */
.btn-logout {
    padding: 0.5rem;
    border-radius: 6px;
    color: #cbd5e1;
    transition: color 0.2s;
}

.btn-logout:hover {
    color: #ef4444;
    background: rgba(255, 255, 255, 0.05);
}

/* RESPONSIVE & MOBILE */

/* 1. Menu Toggle Button (Visible only on mobile) */
.menu-toggle {
    display: none;
    font-size: 1.5rem;
    color: white;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-right: 10px;
}

@media (max-width: 900px) {
    .top-nav {
        padding: 0 1rem;
    }

    .menu-toggle {
        display: block;
    }

    /* Mobile Menu Container */
    .menu {
        display: none;
        position: absolute;
        top: var(--h-height);
        left: 0;
        width: 100%;
        background: #1e293b;
        /* Keep dark theme or White? Let's use Dark to match header */
        flex-direction: column;
        height: auto;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        z-index: 999;
        max-height: calc(100vh - var(--h-height));
        overflow-y: auto;
    }

    .menu.show-mobile {
        display: flex;
        animation: slideDown 0.3s ease-out;
    }

    /* Mobile Items */
    .menu-item {
        height: auto;
        display: flex;
        flex-direction: column;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        align-items: flex-start;
    }

    .menu-link {
        width: 100%;
        padding: 1rem;
        justify-content: space-between;
        color: #cbd5e1;
    }

    /* Mobile Dropdowns */
    .dropdown {
        position: static;
        width: 100%;
        background: #0f172a;
        /* Darker inner */
        border: none;
        border-radius: 0;
        box-shadow: none;
        display: none;
        /* Hidden by default */
        padding-left: 1rem;
    }

    .drop-link {
        color: #94a3b8;
    }

    .drop-link:hover {
        background: rgba(255, 255, 255, 0.05);
        color: white;
    }

    /* Show dropdown only when JS toggles click-open state */
    .menu-item.is-open .dropdown {
        display: flex;
    }

    /* Layouts */
    .pos-layout,
    .col-pos,
    .grid {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .content-wrapper {
        padding: 10px;
    }

    .card {
        padding: 15px;
        overflow-x: auto;
    }

    table {
        min-width: 700px;
    }

    /* Font sizes adjustment */
    h1 {
        font-size: 1.5rem !important;
    }

    .btn {
        width: 100%;
        margin-bottom: 5px;
    }

    .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ANIMATIONS */
.animate-slide-up {
    animation: slideUp 0.4s ease-out forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* CUSTOM SCROLLBAR */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* MODAL OVERLAY FIX */
/* MODAL OVERLAY FIX */
.modal-overlay {
    background: rgba(0, 0, 0, 0.7) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    /* Make sure it's on top of everything */
    display: none;
    align-items: center;
    justify-content: center;
}
