html, body {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

/* ===== TEMA SİSTEMİ ===== */

/* Koyu Tema (varsayılan) */
:root,
[data-theme="dark"] {
    --primary: #5b5fc7;
    --primary-hover: #4a4db4;
    --primary-light: rgba(91, 95, 199, 0.08);

    --bg-main: #0a0e1a;
    --bg-surface: rgba(15, 23, 42, 0.4);
    --card-bg: rgba(30, 41, 59, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);

    --text-main: #e8ecf4;
    --text-muted: #9ca8ba;
    --text-placeholder: #7a8698;

    --accent: #d94051;
    --accent-hover: #c2283a;
    --success: #0ea474;
    --warning: #d68910;
    --info: #0896b3;

    --radius: 0.875rem;
    --shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 8px 32px 0 rgba(0, 0, 0, 0.35);

    --input-bg: rgba(0, 0, 0, 0.2);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus-bg: rgba(0, 0, 0, 0.3);
    --table-bg: transparent;
    --table-hover-bg: rgba(255, 255, 255, 0.04);
    --badge-bg: rgba(255, 255, 255, 0.1);
    --sidebar-bg: rgba(15, 23, 42, 0.4);
    --body-gradient-1: rgba(30, 41, 59, 0.3);
    --body-gradient-2: rgba(91, 95, 199, 0.08);
    --body-gradient-start: #0a0e1a;
    --body-gradient-end: #0f1419;
    --scrollbar-track: rgba(0, 0, 0, 0.05);
    --scrollbar-thumb: rgba(255, 255, 255, 0.08);
}

/* Açık Tema */
[data-theme="light"] {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.08);

    --bg-main: #f1f5f9;
    --bg-surface: rgba(255, 255, 255, 0.85);
    --card-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);

    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-placeholder: #94a3b8;

    --accent: #dc2626;
    --accent-hover: #b91c1c;
    --success: #059669;
    --warning: #d97706;
    --info: #0284c7;

    --shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 32px 0 rgba(0, 0, 0, 0.12);

    --input-bg: rgba(0, 0, 0, 0.03);
    --input-border: rgba(0, 0, 0, 0.12);
    --input-focus-bg: rgba(0, 0, 0, 0.05);
    --table-bg: rgba(255, 255, 255, 0.8);
    --table-hover-bg: rgba(0, 0, 0, 0.03);
    --badge-bg: rgba(0, 0, 0, 0.06);
    --sidebar-bg: rgba(255, 255, 255, 0.85);
    --body-gradient-1: rgba(241, 245, 249, 0.3);
    --body-gradient-2: rgba(79, 70, 229, 0.04);
    --body-gradient-start: #f1f5f9;
    --body-gradient-end: #e2e8f0;
    --scrollbar-track: rgba(0, 0, 0, 0.03);
    --scrollbar-thumb: rgba(0, 0, 0, 0.12);
}

/* ===== GLOBAL STYLES ===== */

body {
    background:
        radial-gradient(circle at top right, var(--body-gradient-1), transparent),
        radial-gradient(circle at bottom left, var(--body-gradient-2), transparent),
        linear-gradient(to bottom, var(--body-gradient-start), var(--body-gradient-end));
    color: var(--text-main);
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    font-weight: 400;
    transition: background 0.3s ease, color 0.3s ease;
}

html {
    overflow-x: hidden;
}

/* Responsive Container */
.container-responsive {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 768px) {
    .container-responsive {
        max-width: 1200px;
    }
}

/* Responsive Table */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(91, 95, 199, 0.5);
}

/* ===== GLASS CARD ===== */

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (hover: hover) {
    .glass-card:hover {
        border-color: var(--glass-border);
        box-shadow: var(--shadow-hover);
        transform: translateY(-1px);
    }
}

/* ===== INPUT ===== */

.glass-input {
    background: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--text-main) !important;
    border-radius: 0.75rem !important;
    padding: 0.75rem 1rem !important;
}

.glass-input:focus {
    background: var(--input-focus-bg) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--primary-light) !important;
}

/* Placeholder kontrastı iyileştirmesi */
::placeholder {
    color: var(--text-placeholder) !important;
    opacity: 1 !important;
}

/* ===== PRODUCT DESIGN ===== */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    padding: 0.5rem 0;
}

.product-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

@media (hover: hover) {
    .product-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
        border-color: rgba(91, 95, 199, 0.4);
    }
}

.product-image-container {
    padding: 0.75rem;
    position: relative;
}

.product-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 0.75rem;
}

.sku-tag {
    font-size: 0.688rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.25rem 0.6rem;
    border-radius: 0.375rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.price-tag {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    letter-spacing: -0.01em;
}

.stock-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.indicator-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}

.dot-green {
    color: var(--success);
    background: var(--success);
}
.dot-red {
    color: var(--accent);
    background: var(--accent);
}
.dot-yellow {
    color: var(--warning);
    background: var(--warning);
}

/* ===== ANIMATIONS ===== */

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: slideInUp 0.4s ease-out forwards;
}

/* ===== BUTTONS ===== */

/* Touch Targets for Mobile */
@media (max-width: 767.98px) {
    button,
    .btn,
    .form-control,
    .form-select,
    .nav-link,
    .cat-link,
    .product-card,
    .theme-toggle-btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
}

/* Global Touch Action Fix */
a, button, .clickable, [onclick] {
    touch-action: manipulation;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(91, 95, 199, 0.2);
    font-weight: 500;
}

@media (hover: hover) {
    .btn-primary:hover {
        background: linear-gradient(135deg, var(--primary-hover) 0%, #3e40a0 100%);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(91, 95, 199, 0.25);
    }
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(91, 95, 199, 0.2);
}

/* ===== TYPOGRAPHY ===== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text-main);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

.fw-bold {
    font-weight: 600 !important;
}

.text-muted {
    color: var(--text-muted) !important;
    font-weight: 400;
}

.text-muted-light {
    color: var(--text-placeholder) !important;
}

.opacity-50 {
    opacity: 0.65 !important;
}

.small {
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ===== TEMA UYUMLU TABLE OVERRIDE ===== */

[data-theme="light"] .table-dark {
    --bs-table-bg: var(--card-bg) !important;
    --bs-table-color: var(--text-main) !important;
    --bs-table-border-color: var(--glass-border) !important;
    --bs-table-hover-bg: var(--table-hover-bg) !important;
    --bs-table-hover-color: var(--text-main) !important;
    background-color: var(--card-bg) !important;
    color: var(--text-main) !important;
}

[data-theme="light"] .table-dark th,
[data-theme="light"] .table-dark td {
    color: var(--text-main) !important;
    border-color: var(--glass-border) !important;
}

[data-theme="light"] .bg-dark {
    background-color: var(--input-bg) !important;
}

[data-theme="light"] .bg-opacity-25 {
    --bs-bg-opacity: 0.08 !important;
}

[data-theme="light"] .text-white {
    color: var(--text-main) !important;
}

[data-theme="light"] .bg-white.bg-opacity-5,
[data-theme="light"] .bg-white.bg-opacity-10 {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .border-white {
    border-color: var(--glass-border) !important;
}

[data-theme="light"] .border-opacity-10 {
    --bs-border-opacity: 0.12 !important;
}

/* ===== TEMA TOGGLE BUTONU ===== */

.theme-toggle-btn {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.theme-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    transform: rotate(15deg);
}

/* ===== SELECT/FORM LIGHT THEME OVERRIDES ===== */

[data-theme="light"] .form-select {
    color: var(--text-main) !important;
}

[data-theme="light"] .form-control {
    color: var(--text-main) !important;
}

[data-theme="light"] .input-group-text {
    color: var(--text-muted) !important;
}

/* ===== BI DASHBOARD LIGHT THEME OVERRIDES ===== */

/* Progress bars on light background */
[data-theme="light"] .progress.bg-white.bg-opacity-10,
[data-theme="light"] .progress.bg-white {
    background-color: rgba(0, 0, 0, 0.08) !important;
}

/* Badge contrast */
[data-theme="light"] .badge.bg-danger.bg-opacity-25 {
    background-color: rgba(220, 38, 38, 0.12) !important;
    color: #dc2626 !important;
}

[data-theme="light"] .badge.bg-warning.bg-opacity-25 {
    background-color: rgba(217, 119, 6, 0.12) !important;
    color: #d97706 !important;
}

[data-theme="light"] .badge.bg-success.bg-opacity-25 {
    background-color: rgba(5, 150, 105, 0.12) !important;
    color: #059669 !important;
}

[data-theme="light"] .badge.bg-info.bg-opacity-25 {
    background-color: rgba(2, 132, 199, 0.12) !important;
    color: #0284c7 !important;
}

/* Insight card backgrounds */
[data-theme="light"] .bg-white.bg-opacity-05 {
    background-color: rgba(0, 0, 0, 0.03) !important;
}

/* Anomaly alert background */
[data-theme="light"] .bg-warning.bg-opacity-10 {
    background-color: rgba(217, 119, 6, 0.08) !important;
}

[data-theme="light"] .bg-danger.bg-opacity-10 {
    background-color: rgba(220, 38, 38, 0.08) !important;
}

[data-theme="light"] .bg-success.bg-opacity-10 {
    background-color: rgba(5, 150, 105, 0.08) !important;
}

[data-theme="light"] .bg-info.bg-opacity-10 {
    background-color: rgba(2, 132, 199, 0.08) !important;
}

/* Extra small text visibility */
.extra-small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

[data-theme="light"] .extra-small {
    color: var(--text-muted) !important;
}

/* Border overrides for light mode */
[data-theme="light"] .border-top.border-white.border-opacity-10 {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

/* KPI card text colors */
[data-theme="light"] .text-info {
    color: #0284c7 !important;
}

[data-theme="light"] .text-success {
    color: #059669 !important;
}

[data-theme="light"] .text-warning {
    color: #d97706 !important;
}

[data-theme="light"] .text-danger {
    color: #dc2626 !important;
}

[data-theme="light"] .text-primary {
    color: #4f46e5 !important;
}

/* BI row heading icon colors in light mode */
[data-theme="light"] .glass-card h5,
[data-theme="light"] .glass-card h6 {
    color: var(--text-main) !important;
}

/* Anomaly alert pills */
[data-theme="light"] .bg-dark.bg-opacity-50 {
    background-color: rgba(0, 0, 0, 0.06) !important;
    color: var(--text-main) !important;
}

/* Nav pills on light mode */
[data-theme="light"] .nav-pills .nav-link {
    color: var(--text-muted);
}

[data-theme="light"] .nav-pills .nav-link.active {
    background-color: var(--primary) !important;
    color: white !important;
}

/* ===== MOBILE RESPONSIVE OVERRIDES ===== */

@media (max-width: 767.98px) {
    /* Touch Targets */
    button, .btn, .form-control, .form-select, .nav-link, input {
        min-height: 44px;
        min-width: 44px;
    }

    /* Layout Stability */
    .page, main, body {
        min-height: 100vh;
    }

    /* Padding Helpers */
    .px-mobile-2 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* POS System Overrides */
    .pos-container {
        flex-direction: column !important;
        height: auto !important;
        padding-bottom: 80px; /* Space for sticky elements if needed */
    }

    .pos-products {
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 1rem;
    }

    .pos-product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        padding-bottom: 1rem !important;
    }

    /* Product Card adjustments for small screens */
    .product-card {
        min-height: 200px !important;
    }

    .product-image {
        height: 120px !important;
    }

    /* Cart Drawer Mobile */
    .pos-cart {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: 0;
        width: 100% !important;
        min-width: 100% !important;
        height: 100% !important;
        z-index: 1040 !important; /* Open Cart: Above Navbar(900), below Mobile Slider(1050) */
        border-radius: 0 !important;
        visibility: hidden; /* Prevent ghost overlay when closed */
        pointer-events: none; /* Prevent interaction when closed */
        opacity: 0;
        transition: all 0.3s ease;
    }

    /* isCartOpen flag is handled by Blazor @if, but in case it's in DOM */
    .pos-cart.show {
        visibility: visible;
        pointer-events: auto;
        opacity: 1;
    }

    /* Table Mobile Card View - Premium Update */
    .table-mobile-card tr {
        margin-bottom: 1.25rem;
        background: var(--card-bg);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid var(--glass-border);
        border-radius: 1rem;
        padding: 1rem;
        box-shadow: var(--shadow);
    }

    .table-mobile-card td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 0.65rem 0 !important;
        border-bottom: 1px solid var(--glass-border);
    }
}

/* ===== NEW MOBILE SYSTEM COMPONENTS ===== */

/* Mobile Bottom Nav Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: none; /* Desktop hidden */
    justify-content: space-around;
    align-items: center;
    z-index: 1040;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}

@media (max-width: 767.98px) {
    .bottom-nav {
        display: flex;
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 1;
    height: 100%;
}

.bottom-nav-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active i {
    transform: translateY(-2px);
    text-shadow: 0 0 10px var(--primary-light);
}

/* Floating Action Button (FAB) */
.mobile-fab {
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(91, 95, 199, 0.4);
    z-index: 1030;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (max-width: 767.98px) {
    .mobile-fab {
        display: flex;
    }
}

.mobile-fab:active {
    transform: scale(0.9) rotate(45deg);
}

/* Mobile Header Sticky */
@media (max-width: 767.98px) {
    header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: var(--bg-main);
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        padding-left: 1rem;
        padding-right: 1rem;
        border-bottom: 1px solid var(--glass-border);
    }
    
    .content {
        padding-bottom: 90px !important;
    }
}

/* Mobile KPI Grid */
@media (max-width: 767.98px) {
    .kpi-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    .kpi-card {
        padding: 0.75rem !important;
    }
    
    .kpi-value {
        font-size: 1.25rem !important;
    }
}

/* ===== UTILITIES ===== */

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* Ensure mobile content has enough padding at bottom */
@media (max-width: 767.98px) {
    .content, .mobile-content-area {
        padding-bottom: 120px !important; /* Safe area for BottomNav + FAB + Spacing */
    }
}
