/* ==========================================================================
   CCC (Cadet College Canteen) SaaS Multi-Tenant Platform
   Color Palette: Navy Blue, Emerald Green, Slate Gray, Clean Modern Aesthetic
   ========================================================================== */

:root {
    --primary: #1a2b49;        /* Cadet Navy Blue */
    --primary-light: #2c3e50;
    --primary-dark: #101c31;
    --accent: #059669;         /* Emerald Green */
    --accent-hover: #047857;
    --accent-light: #d1fae5;
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0284c7;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   2-TIER ENTERPRISE NAVIGATION HEADER
   ========================================================================== */
.ccc-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

/* Tier 1: Top Utility & Tenant Bar */
.ccc-topbar {
    background: #0f172a;
    color: #ffffff;
    padding: 0 24px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    overflow: hidden;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #ffffff;
}

.brand-badge {
    background: var(--accent);
    color: #ffffff;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.2px;
}

.brand-location {
    font-size: 11.5px;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    white-space: nowrap;
}

.tenant-switcher-box {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tenant-lbl {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tenant-select {
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    max-width: 250px;
}

.tenant-select:hover, .tenant-select:focus {
    background: #334155;
    border-color: var(--accent);
}

.user-info-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #e2e8f0;
}

.user-name {
    font-weight: 600;
}

.user-role-badge {
    background: rgba(255, 255, 255, 0.12);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    color: #cbd5e1;
}

.btn-logout {
    color: #f87171;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ffffff;
}

/* Tier 2: Navigation Menu Tabs Bar */
.ccc-navmenu {
    background: linear-gradient(135deg, #1a2b49 0%, #203457 100%);
    padding: 0 24px;
    height: 46px;
    display: flex;
    align-items: center;
}

.nav-tabs-container {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-tabs-container::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.nav-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-tab.active {
    color: #ffffff;
    border-bottom-color: var(--accent);
    background: rgba(255, 255, 255, 0.12);
}

.nav-tab-hq {
    color: #fde047 !important;
}

.nav-tab-hq:hover {
    color: #ffffff !important;
}

@media (max-width: 992px) {
    .brand-location {
        display: none;
    }
    .tenant-select {
        max-width: 180px;
    }
}

@media (max-width: 768px) {
    .ccc-topbar {
        height: auto;
        padding: 8px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .topbar-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .ccc-navmenu {
        padding: 0 12px;
    }
    .nav-tab {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* ==========================================================================
   LAYOUT & CONTAINER
   ========================================================================== */
.ccc-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.page-header p {
    color: var(--text-muted);
    font-size: 13.5px;
}

/* Flash Messages */
.messages-container {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid #16a34a; }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid #dc2626; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #d97706; }
.alert-info { background: #e0f2fe; color: #075985; border-left: 4px solid #0284c7; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-light); }

.btn-accent { background: var(--accent); color: #ffffff; }
.btn-accent:hover { background: var(--accent-hover); }

.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }

.btn-info { background: #0284c7; color: #ffffff; }
.btn-info:hover { background: #0369a1; }

.btn-warning { background: #f59e0b; color: #ffffff; }
.btn-warning:hover { background: #d97706; }

.btn-danger { background: var(--danger); color: #ffffff; }
.btn-danger:hover { background: #dc2626; }

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 20px;
}

/* Stats & KPI Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-val {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    margin-top: 4px;
}

/* ==========================================================================
   POS TERMINAL MODULE
   ========================================================================== */
.pos-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.pos-box {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    padding: 24px;
}

.customer-switcher-tabs {
    display: flex;
    gap: 10px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.btn-cust-type {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: var(--transition);
}

.btn-cust-type.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.btn-cust-type.active-cash {
    background: var(--accent) !important;
    color: #ffffff !important;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.search-input-wrapper input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.search-input-wrapper input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
}

.search-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.search-item:hover {
    background: #f8fafc;
}

/* Selected Cadet Card */
.selected-cadet-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 24px;
}

.cadet-profile-mini {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cadet-avatar-img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.cadet-meta h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}

.cadet-badges {
    display: flex;
    gap: 6px;
    font-size: 12px;
}

.badge-house {
    background: var(--primary);
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.cadet-balance-badge {
    text-align: right;
    background: #ffffff;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.cadet-balance-badge .bal-lbl {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    text-transform: uppercase;
}

.cadet-balance-badge .bal-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
}

/* Cart Table */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.cart-table th {
    background: #f1f5f9;
    padding: 10px 14px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.cart-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.cart-qty-input {
    width: 65px;
    padding: 6px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 700;
}

.btn-remove-item {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 18px;
    cursor: pointer;
    font-weight: 700;
}

/* Cart Summary & Checkout */
.cart-summary-box {
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 18px;
    border: 1px solid var(--border);
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}

.summary-line.total {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    border-top: 2px solid var(--border);
    padding-top: 10px;
    margin-top: 10px;
}

.summary-line input[type="number"] {
    width: 100px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: right;
    font-weight: 700;
}

.btn-checkout {
    width: 100%;
    padding: 14px;
    font-size: 17px;
    font-weight: 700;
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 14px;
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
}

.btn-checkout:hover {
    background: var(--accent-hover);
}

.btn-checkout:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
}

/* ==========================================================================
   DATA TABLES
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 12.5px;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}

.data-table tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 600px;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 18px;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8fafc;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--accent);
    outline: none;
}

/* ==========================================================================
   THERMAL RECEIPT PRINT STYLING (80mm)
   ========================================================================== */
.thermal-receipt {
    width: 320px;
    margin: 0 auto;
    background: #ffffff;
    padding: 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #000000;
    line-height: 1.3;
}

.receipt-header {
    text-align: center;
    margin-bottom: 12px;
}

.receipt-header h2 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 4px;
}

.dashed-line {
    border-top: 1px dashed #000000;
    margin: 8px 0;
}

.receipt-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 3px;
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}

.receipt-table th {
    text-align: left;
    border-bottom: 1px dashed #000;
    padding: 4px 0;
    font-size: 11px;
}

.receipt-table td {
    padding: 4px 0;
    font-size: 11px;
}

.receipt-footer {
    text-align: center;
    font-size: 11px;
    margin-top: 12px;
}

@media print {
    body * {
        visibility: hidden;
    }
    #receipt-print-target, #receipt-print-target * {
        visibility: visible;
    }
    #receipt-print-target {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}
