:root {
    --primary-color: #671f2f;
    /* Deep Burgundy/Wine requested by user */
    --primary-hover: #4a1520;
    --secondary-color: #2D3436;
    --accent-gold: #D4AF37;
    /* For furniture premium feel */
    --sidebar-bg: rgba(30, 30, 30, 0.85);
    /* Glassmorphism base */
    --main-bg: #f8f9fa;
    --card-bg: #FFFFFF;
    --text-dark: #2D3436;
    --text-grey: #636E72;
    --text-light: #DFE6E9;
    --border-color: #E0E0E0;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #ff7675;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--main-bg);
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
}

/* --- UTILITY CLASSES --- */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.grid {
    display: grid;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-2 {
    gap: 1rem;
}

.w-full {
    width: 100%;
}

.text-primary {
    color: var(--primary-color);
}

/* --- HUB / LOGIN SCREEN --- */
.hub-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #8e2a3f 0%, #671f2f 40%, #2c0b11 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.hub-container::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--accent-gold);
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.1;
    top: -100px;
    right: -100px;
}

.brand-logo {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    letter-spacing: -1px;
    animation: fadeInDown 0.8s ease-out;
}

.brand-logo i {
    color: var(--accent-gold);
}

.module-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 2rem;
    width: 100%;
    max-width: 1100px;
    animation: fadeInUp 1s ease-out;
}

.module-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 300px;
    height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


.module-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-15px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.module-card i {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent-gold);
    transition: 0.3s;
}

.module-card:hover i {
    transform: scale(1.1);
}

.module-card h3 {
    font-size: 1.6rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.module-card p {
    font-size: 0.95rem;
    opacity: 0.7;
    line-height: 1.4;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- MAIN LAYOUT (Similar to previous, adjusted) --- */
.app-container {
    display: grid;
    grid-template-columns: 260px 1.5fr 0.5fr;
    height: 100vh;
    width: 100vw;
}

/* For Furniture Layout, we might want full width or different panels */
.app-container.furniture-mode {
    grid-template-columns: 260px 1fr;
    /* 2 Columns only */
}

/* Sidebar */
.sidebar {
    background-color: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-small {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 2.5rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: -0.5px;
}

.brand-small i {
    color: var(--accent-gold);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    margin-bottom: 2.5rem;
}

.avatar-small {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-color), #8e2a3f);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-md);
    color: #a0a0a0;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0.6rem;
    cursor: pointer;
    font-weight: 500;
}

.nav-item i {
    font-size: 1.1rem;
}

.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(103, 31, 47, 0.4);
}

/* Main Content */
.main-content {
    padding: 1.5rem 2rem;
    background: var(--main-bg);
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.unit-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.unit-badge.cafe {
    background: #ffeaa7;
    color: #d35400;
}

.unit-badge.furniture {
    background: #dfe6e9;
    color: #2d3436;
}

/* Product Grid (Cafe) */
.category-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}

.tab-btn {
    padding: 0.6rem 1.5rem;
    border: none;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-grey);
    transition: 0.3s;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    padding-bottom: 2rem;
}

.product-card {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: 0.3s;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.card-img-top {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.card-body {
    padding: 0.8rem;
}

.card-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.card-price {
    color: var(--primary-color);
    font-weight: 700;
}

/* Order Panel (Right Side - Cafe) */
.order-panel {
    background: var(--primary-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    border-left: none;
    color: white;
}

.order-panel h4,
.order-panel .order-header {
    color: white;
    font-weight: 700;
}

.order-panel .cart-row {
    color: white;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.order-panel .cart-row span {
    font-size: 1.1rem;
    font-weight: 700;
}

.order-panel .summary-row {
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
}

.order-panel .total-row,
.order-panel #cafe-total {
    color: white;
    font-weight: 800;
    font-size: 1.8rem;
}

.order-panel .btn-primary {
    background: white;
    color: var(--primary-color);
    font-weight: 700;
}

.order-panel .btn-primary:hover {
    background: #f0f0f0;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin: 1rem 0;
}

.cart-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

/* FURNITURE MODULE STYLES */
.furnit.module-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.furniture-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    height: 100%;
}

.forms-container {
    overflow-y: auto;
    padding-right: 1rem;
}

.form-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: 0.3s;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
}

.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.status-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.step {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    z-index: 2;
}

.step.active {
    background: var(--primary-color);
    color: white;
}

/* Invoice/Summary Panel for Furniture */
.invoice-preview {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    height: fit-content;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.summary-table th {
    text-align: left;
    color: var(--text-grey);
    padding: 0.5rem 0;
    font-size: 0.85rem;
}

.summary-table td {
    padding: 0.5rem 0;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
}

.total-row {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    border-top: 2px solid #eee;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-danger {
    background: var(--danger);
    color: white;
    width: auto;
    padding: 0.5rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 600px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Signature Box */
.signature-box {
    border: 2px dashed #ccc;
    height: 100px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    margin-top: 0.5rem;
}

/* =====================================================
   DASHBOARD & WIDGETS
   ===================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid #f0f0f0;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-label {
    display: block;
    color: #888;
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-value {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.chart-container-main {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid #f0f0f0;
    grid-column: span 1;
    min-height: 350px;
}

.chart-container-main.large {
    grid-column: span 3;
}

.chart-container-main h3 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.table-card {
    grid-column: span 4;
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid #f0f0f0;
    margin-bottom: 2rem;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table th {
    text-align: left;
    padding: 1rem;
    background: #f9f9f9;
    color: #666;
    font-weight: 600;
    font-size: 0.9rem;
}

.modern-table td {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-warning {
    background: #fff3e0;
    color: #f57c00;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-container-main.large,
    .chart-container-main {
        grid-column: span 2;
    }
}

/* --- MODERN SPLIT LOGIN --- */
.login-split-container {
    display: flex;
    width: 1100px;
    max-width: 95%;
    height: 650px;
    background: white;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.2);
    margin: auto;
    animation: zoomIn 0.5s ease-out;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.login-visual-panel {
    flex: 1.3;
    position: relative;
    overflow: hidden;
    background: #000;
}

.login-form-panel {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #ffffff;
}

@media (max-width: 900px) {
    .login-split-container {
        flex-direction: column;
        width: 100vw;
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
    }

    .login-visual-panel {
        flex: 0.7;
        min-height: 40vh;
    }

    .login-form-panel {
        flex: 1.3;
        padding: 2rem;
        border-radius: 30px 30px 0 0;
        margin-top: -30px;
        z-index: 10;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    }
}


.login-input-field {
    width: 100%;
    padding: 15px 25px;
    border-radius: 50px;
    border: 2px solid #edeff2;
    font-size: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #fdfdfd;
    color: #4a5568;
    outline: none;
}

.login-input-field:focus {
    border-color: #671f2f;
    background: white;
    box-shadow: 0 5px 15px rgba(103, 31, 47, 0.1);
}

.login-input-field.pin {
    font-size: 1.5rem;
    letter-spacing: 4px;
    font-weight: 700;
    color: #671f2f;
}


.login-btn-modern {
    width: 100%;
    padding: 18px;
    border-radius: 50px;
    background: linear-gradient(135deg, #671f2f 0%, #4a1520 100%);
    color: white;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(103, 31, 47, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.login-btn-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(103, 31, 47, 0.35);
    filter: brightness(1.1);
}

.login-error-modern {
    margin-top: 20px;
    background: #FFF5F5;
    color: #671f2f;
    padding: 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    text-align: center;
    border: 1px solid #ff7675;
    width: 100%;
}

/* --- MOBILE RESPONSIVENESS & PWA ADAPTATION --- */
@media (max-width: 1024px) {
    .module-selector {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .brand-logo img {
        height: 40px;
    }

    .module-selector {
        grid-template-columns: 1fr;
        gap: 1rem;
        width: 90%;
    }

    .module-card {
        width: 100%;
        height: auto;
        padding: 2.5rem 1.5rem;
    }

    .app-container,
    .app-container.furniture-mode {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: visible;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
    }

    .main-content {
        padding: 1rem;
        overflow-y: visible;
    }

    .order-panel {
        display: none;
        /* Hide order panel on mobile or make it a drawer */
    }

    .furniture-layout {
        grid-template-columns: 1fr;
    }

    .invoice-preview {
        position: static;
        margin-top: 2rem;
    }

    /* Modal fixes */
    .modal-content {
        width: 95%;
        padding: 1rem;
        margin: 10px;
    }

    .row-2,
    .row-3 {
        grid-template-columns: 1fr;
    }
}