@media (max-width: 768px) {
    html, body, .app-container {
        height: auto !important;
        min-height: unset !important;
        max-height: unset !important;
        overflow: visible !important;
    }
    .main-content,
    .panel,
    .table-section {
        height: auto !important;
        min-height: unset !important;
        max-height: unset !important;
        overflow: visible !important;
    }
    .mobile-stock-list {
        display: flex !important;
        flex-direction: column;
        gap: 16px;
        width: 100%;
        margin-top: 0;
        position: relative;
        z-index: 10;
        background: transparent;
    }
    .table-responsive {
        display: none !important;
    }
}
/* Mobilde tabloyu kart görünümüne çevir */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: unset !important;
        padding: 0;
    }
    .stock-table {
        display: none !important;
    }
    .mobile-stock-list {
        display: flex !important;
        flex-direction: column;
        gap: 16px;
        width: 100%;
        margin-top: 0;
    }
    .mobile-stock-card {
        background: var(--panel-bg);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        padding: 16px;
        display: flex;
        gap: 16px;
        align-items: flex-start;
    }
    .mobile-stock-card img {
        width: 72px;
        height: 72px;
        border-radius: 8px;
        object-fit: cover;
        background: var(--input-bg);
        border: 1px solid var(--border-color);
        flex-shrink: 0;
    }
    .mobile-stock-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    .mobile-stock-brand {
        font-weight: 700;
        font-size: 16px;
        color: var(--text-primary);
    }
    .mobile-stock-specs {
        color: var(--text-secondary);
        font-size: 14px;
    }
    .mobile-stock-row {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
        font-size: 13px;
        color: var(--text-secondary);
    }
    .mobile-stock-badge {
        padding: 2px 8px;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 600;
        margin-right: 6px;
        background: var(--hover-bg);
        color: var(--text-primary);
        border: 1px solid var(--border-color);
    }
    .mobile-stock-actions {
        display: flex;
        gap: 8px;
        margin-top: 8px;
    }
    .mobile-stock-actions button {
        font-size: 18px;
        background: transparent;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        color: var(--text-secondary);
        padding: 6px 10px;
        cursor: pointer;
        transition: all 0.2s;
    }
    .mobile-stock-actions button:hover {
        color: var(--accent-red);
        border-color: var(--accent-red);
    }
}
/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.4);
    z-index: 1999;
    transition: opacity 0.3s;
}
/* CSS Variables structure for Dual Theme Support */
:root[data-theme="dark"] {
    --bg-color: #0c0d11;
    --sidebar-bg: #13141a;
    --panel-bg: #181920;
    --border-color: #292a33;
    --border-hover: #3f414d;

    --text-primary: #ededed;
    --text-secondary: #9496a1;
    --text-muted: #5f6377;

    --accent-red: #e11d48;
    --accent-blue: #2563eb;
    --accent-orange: #f59e0b;
    --accent-green: #10b981;

    --table-header-bg: rgba(0, 0, 0, 0.3);
    --hover-bg: rgba(255, 255, 255, 0.03);

    --input-bg: rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] {
    --bg-color: #f3f4f6;
    --sidebar-bg: #ffffff;
    --panel-bg: #ffffff;
    --border-color: #e5e7eb;
    --border-hover: #d1d5db;

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    --accent-red: #be123c;
    --accent-blue: #1d4ed8;
    --accent-orange: #d97706;
    --accent-green: #059669;

    --table-header-bg: #f9fafb;
    --hover-bg: #f3f4f6;

    --input-bg: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s, border-color 0.3s;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* ====== Sidebar ====== */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    flex-shrink: 0;
    transition: background-color 0.3s, border-color 0.3s;
}

.logo-container {
    margin-bottom: 32px;
    padding-left: 12px;
}

.sidebar-logo {
    width: 120px;
    height: 120px;
    display: block;
    object-fit: contain;
    border-radius: 50%;
    /* Tam yuvarlak */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    margin: 0 auto;
    /* Eğer logo-container ortalanmamışsa kendi içinde ortalar */
}

.theme-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 14px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 4px 0 4px 16px;
}

.nav-item.sub-item {
    padding-left: 28px;
    font-size: 13px;
}

.nav-item i {
    font-size: 20px;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: var(--hover-bg);
}

.nav-item.active {
    color: white;
    background-color: var(--accent-red);
}

/* Fix text color for light mode active state */
:root[data-theme="light"] .nav-item.active {
    color: white;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--hover-bg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--accent-red);
}

.user-info .name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.user-info .role {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ====== Main Content ====== */
.main-content {
    flex: 1;
    min-width: 0;
    /* Prevents flexbox horizontal blowout *CRITICAL FIX* */
    display: flex;
    flex-direction: column;
    padding: 32px 40px;
    gap: 28px;
    overflow-y: auto;
    overflow-x: hidden;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    width: 350px;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15);
}

.search-bar i {
    color: var(--text-secondary);
    font-size: 18px;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    width: 100%;
}

.btn-primary {
    background-color: var(--accent-red);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px -1px rgba(225, 29, 72, 0.2);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:hover {
    background-color: #be123c;
}

/* ====== Stats Grid ====== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-card {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

:root[data-theme="dark"] .stat-icon {
    background-blend-mode: overlay;
}

.gray-icon {
    background: rgba(148, 150, 161, 0.1);
    color: var(--text-primary);
}

.blue-icon {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-blue);
}

.orange-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
}

.green-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 4px;
    font-weight: 600;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

/* ====== Table Section ====== */
.table-section {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.table-header h3 {
    font-weight: 700;
    font-size: 18px;
}

.table-actions {
    display: flex;
    gap: 12px;
}

.btn-secondary-icon {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-secondary-icon:hover {
    color: var(--text-primary);
    background-color: var(--hover-bg);
    border-color: var(--border-hover);
}

.table-responsive {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
}

.stock-table th {
    text-align: left;
    padding: 16px 24px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--table-header-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.stock-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    vertical-align: middle;
}

.stock-table tbody tr {
    transition: background-color 0.2s;
}

.stock-table tbody tr:hover {
    background-color: var(--hover-bg);
}

/* Product Identity Format */
.product-cell {
    display: flex;
    align-items: center;
    gap: 16px;
}

.product-img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    display: inline-block;
}

.product-info {
    display: flex;
    flex-direction: column;
}

.item-brand {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 15px;
}

.item-specs {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.item-code {
    font-family: monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Condition Badges */
.badge-new {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-blue);
    border: 1px solid rgba(37, 99, 235, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-used {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
    border: 1px solid rgba(245, 158, 11, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.qty {
    font-weight: 600;
    color: var(--text-primary);
}

.qty-low {
    color: var(--accent-red);
}

.price {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 15px;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--hover-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.action-btn.delete:hover {
    color: var(--accent-red);
    background: rgba(225, 29, 72, 0.1);
    border-color: rgba(225, 29, 72, 0.2);
}

/* Empty State */
.empty-state {
    padding: 60px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
}

/* ====== Modal ====== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 600px;
    padding: 32px;
    border-radius: 16px;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    /* Kırpılmayı önlemek için sınır */
    overflow-y: auto;
    /* Dikey scroll ekle */
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.close-btn {
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-cancel:hover {
    background: var(--hover-bg);
}

/* ====== Responsive Mobile CSS ====== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    /* Sidebar Hidden by Default on Mobile */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 2000;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
        transition: left 0.3s ease;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar-overlay.active {
        display: block !important;
    }

    /* Hamburger Menu Toggle */
    .mobile-menu-toggle {
        display: block !important;
        color: var(--text-primary);
    }

    .main-content {
        padding: 20px 16px;
    }

    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .search-bar {
        width: 100%;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Table Responsiveness: Allow Horizontal Scroll */
    .table-section {
        border-radius: 8px;
    }

    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        display: block !important;
        width: 100%;
    }

    .stock-table {
        min-width: 600px;
        width: 100%;
        display: table !important;
    }

    .stock-table th,
    .stock-table td {
        white-space: nowrap;
    }

    .modal-content {
        padding: 20px 16px;
        width: 95%;
        margin: 10px auto;
        max-height: 85vh;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}
/* VIEW MODAL ACTIVE DURUMU */
.modal-overlay.active {
    display: flex !important;
}

/* --- YENİ ÜRÜN DETAY & SLAYT TASARIMLARI --- */
.slider-main {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 350px;
}
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: 0.2s;
}
.slider-btn:hover { background: var(--accent-blue); }
#sliderPrev { left: 10px; }
#sliderNext { right: 10px; }

#sliderThumbs::-webkit-scrollbar { height: 6px; }
#sliderThumbs::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.thumb-img {
    width: 70px; 
    height: 70px; 
    object-fit: cover; 
    border-radius: 6px; 
    cursor: pointer; 
    border: 2px solid transparent; 
    opacity: 0.5; 
    transition: 0.2s;
    flex-shrink: 0;
}
.thumb-img:hover { opacity: 0.8; }
.thumb-img.active { border-color: var(--accent-blue); opacity: 1; }

#lightboxModal { 
    background: rgba(0,0,0,0.95); 
    display: none; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    z-index: 99999;
}