/* ===== FlowDash-inspired Base ===== */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}
@media (min-width: 768px) {
    html { font-size: 15px; }
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: #1e293b;
    color: #cbd5e1;
    z-index: 1040;
    transition: width 0.25s ease, transform 0.25s ease;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}
.sidebar.collapsed {
    width: 0;
    transform: translateX(-260px);
}

.sidebar-brand {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    white-space: nowrap;
}
.sidebar-brand a i {
    font-size: 1.4rem;
    color: #FF6B35;
}
.sidebar-brand a:hover {
    color: #FF6B35;
}

.sidebar-nav {
    padding: 0.5rem 0;
}
.sidebar-nav .nav-item-heading {
    padding: 0.75rem 1.25rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    white-space: nowrap;
}
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1.25rem;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.4rem;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
    border-left-color: #FF6B35;
}
.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link.active:hover {
    color: #fff;
    background: rgba(255,107,53,0.12);
    border-left-color: #FF6B35;
}

/* ===== Main Wrapper ===== */
.main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}
.main-wrapper.expanded {
    margin-left: 0;
}

/* ===== Topbar ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.topbar-left .sidebar-toggle {
    color: #475569;
    padding: 0.25rem;
    line-height: 1;
}
.topbar-left .sidebar-toggle:hover {
    color: #FF6B35;
}
.topbar-page-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 1.5rem;
    background: #f1f5f9;
}

/* ===== Footer ===== */
.footer {
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 0.75rem 0;
    text-align: center;
    font-size: 0.82rem;
    color: #64748b;
    margin-left: 260px;
    transition: margin-left 0.25s ease;
}
.main-wrapper.expanded ~ .footer,
.main-wrapper.expanded + .footer {
    margin-left: 0;
}

/* ===== Override existing Bootstrap components for FlowDash look ===== */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-header {
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0.5rem 0.5rem 0 0 !important;
}
.table {
    --bs-table-hover-bg: #f8fafc;
}

/* ===== Barcode Badge ===== */
.barcode-badge {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 0.2em 0.5em;
    border-radius: 0.25rem;
    font-size: 0.85em;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    white-space: nowrap;
}

/* ===== Summary Cards (Sales Report) ===== */
.summary-card {
    border-left: 3px solid #FF6B35;
}
.summary-card .summary-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
}
.summary-card .summary-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 600;
}

/* ===== KPI Cards (Dashboard) ===== */
.kpi-card {
    border-left: 3px solid #FF6B35;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}
.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 600;
}
.kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
}

/* ===== Dashboard Card Headers ===== */
.dash-card-header {
    background: transparent;
    border-bottom: 0;
    padding: 0;
}

/* ===== Quick Preset Buttons ===== */
.quick-preset {
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
}
.quick-preset.active,
.quick-preset:focus {
    background: #FF6B35;
    color: #fff;
    border-color: #FF6B35;
}

/* ===== Salesman Row ===== */
.sm-row:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* ===== Control uniform height ===== */
.card-header .form-control-sm,
.card-header .form-select-sm {
    height: 32px;
    font-size: 0.78rem;
}
.card-header .btn-sm {
    height: 32px;
    padding: 0 0.6rem;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
}

/* ===== Table enhancements ===== */
.table > thead {
    position: sticky;
    top: 0;
    z-index: 10;
}
.table > thead > tr > th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    border-bottom-width: 2px;
    padding: 0.65rem 0.75rem;
}
.table > tbody > tr > td {
    padding: 0.6rem 0.75rem;
    font-size: 0.88rem;
    vertical-align: middle;
}
.table-hover > tbody > tr:hover > td {
    background-color: #f8fafc;
}

/* ===== Focus states ===== */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ===== Dropzone Area ===== */
.dropzone-area {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}
.dropzone-area:hover,
.dropzone-area.dragover {
    background-color: #f0f7ff !important;
    border-color: #0d6efd !important;
}
.cursor-pointer {
    cursor: pointer;
}

/* ===== Form floating placeholder ===== */
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ===== Mobile Responsive (Sales Report) ===== */
@media (max-width: 768px) {
    .summary-card .summary-value {
        font-size: 1.15rem;
    }
    .summary-card .summary-label {
        font-size: 0.75rem;
    }
    #salesTable th,
    #salesTable td {
        padding: 0.5rem 0.6rem;
        font-size: 0.82rem;
    }
    #salesTable .barcode-badge {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
    .card-header .badge {
        font-size: 0.75rem !important;
    }
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-260px);
        width: 260px;
    }
    .sidebar.collapsed {
        transform: translateX(0);
        width: 260px;
    }
    .main-wrapper {
        margin-left: 0 !important;
    }
    .footer {
        margin-left: 0 !important;
    }
    .main-wrapper.expanded {
        margin-left: 0;
    }
}
