:root {
    --primary: #2D7A68;
    --primary-hover: #246354;
    --primary-light: #f0fdf4;
    --primary-border: #bbf7d0;
    --primary-rgb: 45, 122, 104;
    
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* HEADER */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), #1a5c4d);
    color: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35);
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35);
}

/* FETCH (İçe Çekme / Inbound - Profesyonel İndigo Mavi) */
.btn-fetch {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: 1px solid #1e40af;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.btn-fetch:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* SYNC (Dışa Yükleme / Outbound - Dikkat Çekici Canlı Turuncu / Amber) */
.btn-sync {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #ffffff;
    border: 1px solid #92400e;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.btn-sync:hover {
    background: linear-gradient(135deg, #b45309, #78350f);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.btn-outline {
    background-color: #ffffff;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* MAIN LAYOUT */
.app-main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 32px 48px;
}

/* STATS ROW */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-products { background: #eff6ff; color: #2563eb; }
.icon-features { background: #f0fdf4; color: #16a34a; }
.icon-categories { background: #faf5ff; color: #9333ea; }
.icon-status { background: #fff7ed; color: #ea580c; }

.stat-content {
    display: flex;
    flex-direction: column;
}

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

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

.status-ready {
    color: #16a34a !important;
}

.status-pulse {
    display: inline-block;
    width: 9px;
    height: 9px;
    background: #eab308;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulseDot 0.8s infinite alternate;
}

@keyframes pulseDot {
    from { opacity: 0.3; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1.3); }
}

.btn-primary.loading {
    opacity: 0.85;
    cursor: wait;
    position: relative;
}

.btn-primary.loading svg {
    animation: spinIcon 0.8s linear infinite;
}

.stat-progress-bar-wrap {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    margin-top: 8px;
    overflow: hidden;
}

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

/* PRODUCT CATEGORY TABS (CATEGORY-FIRST BAR) */
.category-tabs-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.category-tabs-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    flex-shrink: 0;
}

.category-tabs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cat-tab-btn {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cat-tab-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

.cat-tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.cat-pill {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
    white-space: nowrap;
}

/* WORKSPACE GRID */
.workspace-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.panel-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title-wrap h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.badge {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

.panel-controls {
    display: flex;
    gap: 8px;
}

.search-filter-box {
    padding: 12px 18px;
    background: #fcfcfd;
    border-bottom: 1px solid var(--border-color);
}

.input-search {
    width: 100%;
    padding: 9px 14px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #ffffff;
    outline: none;
    transition: all 0.2s;
}

.input-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

/* TAXONOMY TREE */
.taxonomy-tree {
    padding: 14px 18px;
    max-height: 680px;
    overflow-y: auto;
}

.category-block {
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.cat-header {
    background: #f8fafc;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.cat-feature-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
    cursor: pointer;
}

.cat-feature-item:last-child {
    border-bottom: none;
}

.cat-feature-item:hover {
    background: #f8fafc;
}

.cat-feature-item.active-test {
    background: var(--primary-light);
    border-color: var(--primary-border);
}

.cat-feature-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #fafafa;
    pointer-events: none;
}

.cat-feature-item.disabled .feat-name {
    color: var(--text-light);
}

.cat-feature-item.disabled .feat-count {
    background: #f1f5f9;
    color: #cbd5e1;
}

.feat-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.feat-icon-preview {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.feat-name {
    font-weight: 500;
    color: var(--text-main);
}

.feat-count {
    font-size: 11px;
    font-weight: 700;
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 2px 7px;
    border-radius: 10px;
}

.active-test .feat-count {
    background: var(--primary);
    color: #ffffff;
}

/* FILTER TEST BAR */
.filter-test-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.active-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.test-chip {
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.test-chip-remove {
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}

.chip-hint {
    font-size: 11px;
    color: var(--text-light);
    font-style: italic;
}

/* PRODUCTS TABLE */
.table-container {
    max-height: 680px;
    overflow-y: auto;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.products-table th {
    background: #f8fafc;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.products-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    vertical-align: middle;
}

.products-table tr:hover {
    background: #fcfcfd;
}

.prod-thumb {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    padding: 2px;
}

.prod-name {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 2px;
}

.prod-code {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ATOMIC FEATURE PILLS & ICONS IN TABLE */
.feature-pills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.feature-pill-badge {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    color: #334155;
    transition: all 0.2s ease;
}

.feature-pill-badge:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.pill-icon {
    display: inline-flex;
    color: var(--primary);
}

.prod-price {
    font-weight: 700;
    color: #0f172a;
    font-size: 14px;
}

.empty-state, .empty-row {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

/* MODALS */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-backdrop.open {
    display: flex;
}

.modal-window {
    background: #ffffff;
    border-radius: 16px;
    width: 520px;
    max-width: 90vw;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalIn 0.2s ease-out;
}

.modal-lg {
    width: 780px;
}

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

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.form-textarea {
    height: 120px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.form-input:focus, .form-textarea:focus {
    border-color: var(--primary);
}

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.code-preview {
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    max-height: 380px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
