:root {
    /* Color Palette */
    --bg-dark: #09090b;
    --bg-panel: #18181b;
    --bg-card: rgba(39, 39, 42, 0.4);
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Layout Variables */
    --sidebar-width: 260px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Effects */
    --glass-blur: blur(12px);
    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.05), transparent 25%);
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--text-main);
}

.logo i {
    color: var(--primary);
    font-size: 28px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-item i {
    font-size: 20px;
}

.nav-item:hover, .nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.nav-item.active {
    position: relative;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: var(--shadow-glow);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-dark);
    padding: 2px;
    border: 2px solid var(--primary);
}

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

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    width: 350px;
    gap: 10px;
    transition: all 0.3s ease;
}
.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-bar i {
    color: var(--text-muted);
    font-size: 18px;
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-main);
    width: 100%;
    font-size: 14px;
}

.search-results-dropdown {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glow);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    flex-direction: column;
}
.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.2s;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover {
    background: rgba(59, 130, 246, 0.15);
}
.search-result-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}
.search-result-meta {
    font-size: 12px;
    color: var(--text-muted);
}
.search-result-category {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--primary);
    font-weight: bold;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.secondary-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.secondary-btn:hover {
    background: var(--bg-panel);
    border-color: var(--text-muted);
}

.danger-btn {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.danger-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Utils */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* Views */
.views {
    padding: 32px 40px;
    flex: 1;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.view.active {
    display: block;
}

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

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0;
}
#dashboard .page-title, #production .page-title, #products .page-title {
    margin-bottom: 32px;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    backdrop-filter: var(--glass-blur);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-subtle);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-details h3 {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-details p {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}
.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}
.tab-btn.active {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

/* Tables */
.recent-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: var(--glass-blur);
    overflow: hidden;
}

.section-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}
.section-header h2 { font-size: 18px; font-weight: 600; }

.table-container {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.2);
}

.data-table td { font-size: 14px; }
.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.data-table tbody tr.negative-stock-row { background: rgba(239, 68, 68, 0.15) !important; }
.data-table tbody tr.critical-stock-row { background: rgba(234, 179, 8, 0.15) !important; }
.inventory-table { table-layout: fixed; width: 100%; }

/* Status & Type Badges */
.type-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    border: 1px solid;
}
.type-hammadde { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.type-badge.type-mamul { background: rgba(16, 185, 129, 0.15); color: #10b981; }

/* MACHINES & WORK ORDERS */
.machine-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.machine-card h3 {
    margin: 0;
    font-size: 16px;
}
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.status-badge.status-idle { background: rgba(59, 130, 246, 0.1); color: #3b82f6; border: 1px solid #3b82f6; }
.status-badge.status-working { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid #10b981; }
.status-badge.status-broken { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid #ef4444; }

.work-orders-kanban {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 12px;
}
.kanban-column {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    min-width: 300px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.kanban-column h4 {
    margin: 0 0 8px 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    color: var(--text-muted);
}
.wo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.wo-card-header h5 {
    margin: 0;
    font-size: 14px;
    color: var(--text-main);
}
.wo-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.type-mamul { border-color: rgba(16, 185, 129, 0.3); }

/* Recipes Grid */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.recipe-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.2s;
}
.recipe-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.2);
}
.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.recipe-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}
.recipe-materials {
    list-style: none;
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(0,0,0,0.2);
    padding: 12px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.recipe-materials li {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 4px;
}
.recipe-materials li:last-child { border: none; padding-bottom: 0; }

/* Production Form */
.production-container {
    display: flex;
    justify-content: center;
}
.production-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 500px;
    backdrop-filter: var(--glass-blur);
}
.production-form-card h2 {
    font-size: 20px;
    margin-bottom: 24px;
}
.material-preview {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 24px;
}
.material-preview h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-muted);
}
.material-preview ul {
    list-style: none;
    font-size: 13px;
}
.material-preview li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.material-preview li.insufficient {
    color: var(--danger);
}

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
    z-index: 100; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content, .modal {
    background: var(--bg-panel); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); width: 100%; max-width: 500px;
    box-shadow: var(--shadow-subtle); transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh; overflow-y: auto; overflow-x: hidden;
}
.modal-overlay.active .modal-content,
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
    padding: 24px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; background: var(--bg-panel); z-index: 10;
}
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.close-btn:hover { color: var(--text-main); }
form { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    background: var(--bg-dark); border: 1px solid var(--border-color);
    color: var(--text-main); padding: 12px; border-radius: var(--radius-sm);
    outline: none; font-family: inherit; font-size: 14px; transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 10px; }

/* Custom Form Elements */
.radio-group {
    display: flex; gap: 16px;
}
.radio-label {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    background: var(--bg-dark); padding: 10px 16px; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); flex: 1; transition: all 0.2s;
}
.radio-label:has(input:checked) {
    border-color: var(--primary); background: rgba(59,130,246,0.1);
}

.recipe-materials-list {
    display: flex; flex-direction: column; gap: 10px;
}
.material-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}
.material-row:hover {
    border-color: rgba(255, 255, 255, 0.2);
}
.material-row.is-sheet-item {
    background: rgba(59, 130, 246, 0.04);
    border-color: rgba(59, 130, 246, 0.3);
}
.material-row.is-sheet-item:hover {
    border-color: rgba(59, 130, 246, 0.5);
}
.material-row-top {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}
.material-thumb-preview {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    cursor: pointer;
    flex-shrink: 0;
    display: none;
}
.material-qty-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.material-qty-wrapper input.material-qty {
    width: 82px !important;
    min-width: 75px !important;
    padding: 8px 6px !important;
    text-align: center !important;
    font-weight: 700 !important;
    font-size: 13px !important;
}
.material-row-bottom {
    display: none;
    gap: 8px;
    align-items: center;
    width: 100%;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.material-row.is-sheet-item .material-row-bottom {
    display: flex;
}
.material-row .form-group { margin: 0; }
.remove-row-btn {
    background: none; border: none; color: var(--danger); font-size: 18px; cursor: pointer; padding: 4px;
    flex-shrink: 0;
}
.btn-sheet-calc {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 600;
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}
.material-row.is-sheet-item .btn-sheet-calc {
    display: inline-flex;
}
.btn-sheet-calc:hover {
    background: #3b82f6;
    color: white;
}
.btn-toggle-cut-note {
    font-size: 11px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: color 0.2s;
}
.btn-toggle-cut-note:hover {
    color: #60a5fa;
}

/* Sheet Calculator Modal Clean Styles */
#sheetCalcModal .modal-content {
    max-width: 530px;
    width: 95%;
    margin: 20px auto;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    border: 1px solid rgba(59, 130, 246, 0.3);
}
#sheetCalcModal .sheet-calc-body {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
}
#sheetCalcModal .calc-grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    width: 100%;
}
#sheetCalcModal .calc-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}
#sheetCalcModal .form-group input,
#sheetCalcModal .form-group select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 13px;
}
.hvac-tab-bar {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}
.hvac-tab-btn {
    flex: 1;
    min-width: 76px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.hvac-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}
.hvac-tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.hvac-pane {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.hvac-hint {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(59, 130, 246, 0.05);
    padding: 6px 8px;
    border-radius: 4px;
    border-left: 2px solid #3b82f6;
    line-height: 1.3;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    box-shadow: var(--shadow-subtle);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.08), transparent 25%);
}

.login-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-glow);
    backdrop-filter: var(--glass-blur);
}
.text-danger {
    color: var(--danger);
}

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 15;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Hide Sidebar by default on mobile */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 20;
    }
    
    .sidebar.active {
        left: 0;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .topbar {
        padding: 16px 20px;
        gap: 12px;
    }

    .search-bar {
        width: 100%;
        flex: 1;
    }

    #apiStatus {
        font-size: 0; /* visually hide text */
    }
    #apiStatus i {
        font-size: 20px;
    }
    
    #btnAddProduct span {
        display: none; /* Hide text in top button */
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .section-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .filter-bar {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .filter-bar input, .filter-bar select {
        flex: 1;
        min-width: 120px;
    }
    
    .data-table-container {
        width: 100%;
        overflow-x: auto;
    }

    .data-table {
        min-width: 600px;
    }
    
    /* Fix overflowing forms */
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    /* Kanban adjustments */
    .work-orders-kanban {
        flex-direction: column;
    }
    
    .kanban-column {
        width: 100%;
        min-width: unset;
    }
}

/* YENİ İŞ EMRİ TAM EKRAN UYARISI (MODERN DARK SLATE CAM EFEKTİ & DİKKAT ÇEKİCİ YANIP SÖNME) */
.new-wo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.92); /* Koyu slate yarı saydam şık arka plan */
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.new-wo-content {
    background: #1e293b;
    border: 2px solid rgba(239, 68, 68, 0.6);
    padding: 42px 36px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(239, 68, 68, 0.3);
    max-width: 90%;
    width: 520px;
    animation: popIn 0.35s cubic-bezier(0.16, 1, 0.3, 1), alertBorderPulse 1s infinite alternate;
}

@keyframes alertBorderPulse {
    0% {
        border-color: rgba(239, 68, 68, 0.4);
        box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 20px rgba(239, 68, 68, 0.25);
    }
    100% {
        border-color: rgba(248, 113, 113, 1);
        box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 45px rgba(239, 68, 68, 0.65);
    }
}

.new-wo-icon-wrapper {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(220, 38, 38, 0.4) 100%);
    border: 2.5px solid #ef4444;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.55);
    animation: alertIconShake 1.2s infinite ease-in-out;
}

.new-wo-icon {
    font-size: 44px;
    color: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes alertIconShake {
    0%, 100% { transform: scale(1) rotate(0deg); }
    15% { transform: scale(1.12) rotate(-14deg); }
    30% { transform: scale(1.12) rotate(14deg); }
    45% { transform: scale(1.12) rotate(-10deg); }
    60% { transform: scale(1.12) rotate(10deg); }
    75% { transform: scale(1.05) rotate(-4deg); }
    90% { transform: scale(1) rotate(0deg); }
}

.new-wo-title {
    font-size: 28px;
    font-weight: 900;
    margin-bottom: 12px;
    letter-spacing: 0.8px;
    animation: alertTextBlink 0.75s infinite alternate;
}

@keyframes alertTextBlink {
    0% {
        color: #ef4444;
        text-shadow: 0 0 20px rgba(239, 68, 68, 0.95), 0 0 40px rgba(239, 68, 68, 0.7);
        transform: scale(1.03);
    }
    100% {
        color: #ffffff;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 25px rgba(59, 130, 246, 0.7);
        transform: scale(0.98);
    }
}

.new-wo-desc {
    font-size: 15px;
    color: #cbd5e1;
    margin-bottom: 28px;
    line-height: 1.6;
}

.new-wo-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
    padding: 16px 36px;
    font-size: 17px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.new-wo-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(16, 185, 129, 0.45);
}

.new-wo-btn:active {
    transform: translateY(1px);
}

@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* =========================================
   CHAT UI STYLES
   ========================================= */
.chat-bubble {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.chat-bubble.admin {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chat-bubble.worker {
    align-self: flex-start;
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid #334155;
    border-bottom-left-radius: 4px;
}

.chat-sender {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-bubble.admin .chat-sender {
    color: #bfdbfe;
}

.chat-bubble.worker .chat-sender {
    color: #94a3b8;
}

.chat-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    align-self: flex-end;
}

.chat-empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.chat-empty-state i {
    font-size: 48px;
    color: #475569;
}

/* --- KISMI IMALAT & ILERLEME CUBUGU (PARTIAL PRODUCTION) --- */
.wo-progress-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wo-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.wo-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
    border-radius: 999px;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.wo-progress-fill.complete {
    background: #10b981;
}

.worker-item-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s ease;
}

.worker-item-card.is-done {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.35);
}

.quick-chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.quick-chip {
    flex: 1;
    min-width: 62px;
    padding: 10px 12px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.quick-chip:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.quick-chip:active {
    transform: scale(0.95);
}

.quick-chip.chip-all {
    flex-basis: 100%;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.4);
}

.quick-chip.chip-all:hover {
    background: #10b981;
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Mal Kabul / İrsaliye Satır Tasarımı */
.receipt-item-row {
    display: grid;
    grid-template-columns: 2.2fr 1.2fr 1.2fr 1.2fr 42px;
    gap: 10px;
    align-items: center;
    background: var(--bg-dark);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}
.receipt-item-row:hover {
    border-color: rgba(16, 185, 129, 0.4);
}
@media (max-width: 768px) {
    .receipt-item-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* CARİ & MÜŞTERİ YÖNETİMİ MODERN STİLLERİ */
#customers .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#customers .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

#customers-table tr:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

.cari-tab-active {
    border-bottom: 2px solid var(--primary) !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
}

#cariEkstreModal table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #1e293b;
}

#cariEkstreModal tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

#cariEkstreModal .data-table th,
#cariEkstreModal .data-table td {
    padding: 11px 14px;
    vertical-align: middle;
}




