/* ACP Kesim Optimizasyon Programı — Endüstriyel Arayüz Stilleri (/css/app.css) */

:root {
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 13.5px;
    line-height: 1.45;
}

/* Ana İskelet */
.app-shell {
    display: grid;
    grid-template-columns: 245px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-sidebar);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand-box {
    padding: 8px 10px 18px 10px;
    border-bottom: 1px solid #1e293b;
    margin-bottom: 14px;
}

.brand-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
}

.brand-sub {
    font-size: 11.5px;
    color: #94a3b8;
    margin-top: 3px;
}

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

.nav-btn {
    background: transparent;
    color: #cbd5e1;
    border: none;
    text-align: left;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s, color 0.15s;
}

.nav-btn:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.nav-btn.active {
    background: var(--primary);
    color: #fff;
}

.sidebar-footer {
    border-top: 1px solid #1e293b;
    padding-top: 12px;
    font-size: 11.5px;
    color: #94a3b8;
}

/* Sağ Ana İçerik */
.main-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-container {
    padding: 20px 22px;
    flex: 1;
}

.app-view {
    display: none;
}

.app-view.active {
    display: block;
}

/* Kartlar ve Gridler */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.stat-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 6px;
}

.panel-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 12px;
    flex-wrap: wrap;
}

.panel-header h3 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 700;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

/* Form Elemanları */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: var(--text-main);
}

.input-sm {
    padding: 5px 8px;
    font-size: 12.5px;
    width: 100%;
}

.input-xs {
    padding: 4px 6px;
    font-size: 12.5px;
    width: 72px;
}

.dims-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Butonlar */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

.btn-outline {
    background: #fff;
    color: #1e293b;
    border-color: #cbd5e1;
}

.btn-outline:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11.5px;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12.5px;
}

.btn-lg {
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
}

.btn-block {
    width: 100%;
}

.btn-group-inline {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Tablolar */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    font-weight: 700;
    color: #334155;
    font-size: 12px;
    text-transform: uppercase;
}

tr.row-danger {
    background: #fef2f2;
}

.muted-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

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

/* Rozetler (Badges) */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-neutral { background: #e2e8f0; color: #334155; }

/* DXF Uyarı ve Önizleme */
.diagnostics-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.diag-list {
    margin: 6px 0 0 0;
    padding-left: 18px;
}

.diag-error { color: #b91c1c; font-weight: 600; }
.diag-warning { color: #92400e; }
.part-warn-text { color: #dc2626; font-size: 11px; font-weight: 600; margin-top: 3px; }

/* Optimizasyon Alternatif Kartları */
.alternatives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.alt-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alt-card.active {
    border-color: var(--primary);
    background: #f8fafc;
}

.alt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alt-card-header h4 {
    margin: 0;
    font-size: 15px;
}

.alt-card-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.alt-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 12.5px;
    background: #f8fafc;
    padding: 10px;
    border-radius: 6px;
}

.alt-metrics-grid span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

/* Kesim Planı Düzeni */
.plan-layout {
    display: grid;
    grid-template-columns: 1fr 330px;
    gap: 16px;
    align-items: start;
}

.sheet-tabs-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.sheet-tab-btn {
    background: #fff;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 7px 12px;
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
    white-space: nowrap;
}

.sheet-tab-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.sheet-tab-btn .tab-sub {
    display: block;
    font-size: 11px;
    font-weight: 500;
    opacity: 0.85;
}

.svg-stage-container {
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    height: 640px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    user-select: none;
}

.cutting-plan-svg {
    width: 100%;
    height: 100%;
}

.collision-banner {
    background: #fef2f2;
    border: 2px solid #dc2626;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 6px;
    font-weight: 700;
    margin-bottom: 10px;
}

.cut-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.cut-step-item:hover {
    background: #eff6ff;
}

.cut-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.remnant-offer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    margin-bottom: 6px;
}

.inspector-row {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 12.5px;
}

.inspector-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* Atölye Modu (Tablet) */
.workshop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.workshop-card {
    background: #fff;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.workshop-card.cut-done {
    border-color: var(--success);
    background: #f0fdf4;
}

.workshop-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ws-code { font-size: 18px; font-weight: 800; }
.ws-dims { font-size: 15px; font-weight: 700; color: var(--primary); }
.ws-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* İlerleme Çubuğu */
.progress-wrap {
    margin: 12px 0;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    padding: 4px;
}

.progress-bar {
    height: 12px;
    background: var(--primary);
    border-radius: 6px;
    width: 0%;
    transition: width 0.2s;
}

/* Bildirim (Toast) */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

.toast {
    padding: 11px 16px;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.toast-info { background: #1e293b; }
.toast-success { background: #15803d; }
.toast-warning { background: #d97706; }
.toast-error { background: #dc2626; }

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-weight: 600;
}
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Soru İşareti (?) Yardım Butonu & Pop-up Modal Stilleri */
.title-with-help {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.help-q-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    border: 1.5px solid #93c5fd;
    font-size: 12.5px;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.help-q-btn:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #1d4ed8;
    transform: scale(1.08);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.help-q-btn-sm {
    width: 18px;
    height: 18px;
    font-size: 11px;
    margin-left: 4px;
    vertical-align: middle;
}

.help-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10000;
}

.help-modal-card {
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 660px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.28);
    border: 1px solid #cbd5e1;
    overflow: hidden;
    animation: helpPopIn 0.16s ease-out;
}

@keyframes helpPopIn {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 22px 14px 22px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.help-modal-close {
    background: #e2e8f0;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-modal-close:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.help-modal-body {
    padding: 18px 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.help-section-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.help-section-text {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: #334155;
}

.help-list {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: #1e293b;
}

.help-rules-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px 14px;
}

.help-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 22px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { height: auto; position: static; }
    .nav-menu { flex-direction: row; flex-wrap: wrap; }
    .plan-layout, .grid-2 { grid-template-columns: 1fr; }
}
