/* =============================================================================
   OptiMaster SaaS - Ultra Modern UI/UX Tasarım Sistemi
   İlham Kaynakları: Coursie, Shopr, FundFlow, AppDistro, NguaworNet
   Özellikler: Kapsül butonlar, ambient soft shadows, 24px kavisli kartlar,
               koyu/açık tema, responsive atölye ve dokunmatik saha arayüzü.
   ============================================================================= */

:root {
    /* Açık Tema (Varsayılan) */
    --bg-app: #F5F6FC;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-subtle: #F8F9FE;
    --bg-input: #F3F4F9;
    --text-primary: #1E1B39;
    --text-secondary: #717595;
    --text-muted: #9DA3C1;
    --border-color: #E7E9F4;
    --border-light: rgba(231, 233, 244, 0.6);

    /* Marka Vurgu Renkleri */
    --primary: #5850EC;
    --primary-hover: #4F46E5;
    --primary-light: #EEF2FF;
    --primary-gradient: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
    --accent-cyan: #06B6D4;
    --accent-pink: #EC4899;
    --accent-amber: #F59E0B;
    --accent-emerald: #10B981;
    --accent-danger: #EF4444;

    /* Gölgeler (Ambient Soft Shadows) */
    --shadow-card: 0 10px 30px -5px rgba(30, 27, 57, 0.05), 0 2px 8px -2px rgba(30, 27, 57, 0.03);
    --shadow-hover: 0 18px 40px -8px rgba(88, 80, 236, 0.12);
    --shadow-pill: 0 4px 14px rgba(88, 80, 236, 0.25);

    /* Geometri */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --radius-pill: 9999px;
    --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Koyu Tema (Görsel 3: NguaworNet Stili) */
[data-theme="dark"] {
    --bg-app: #0D0B1E;
    --bg-sidebar: #14122C;
    --bg-card: #181534;
    --bg-card-subtle: #201C42;
    --bg-input: #231F48;
    --text-primary: #F3F4F8;
    --text-secondary: #A09DC1;
    --text-muted: #6B6894;
    --border-color: #272352;
    --border-light: rgba(39, 35, 82, 0.8);
    --shadow-card: 0 12px 36px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 20px 45px rgba(99, 102, 241, 0.2);
}

/* Sıfırlama & Temel Tipografi */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Plus Jakarta Sans", "Inter", "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* App Kapsayıcı Düzeni */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* =============================================================================
   1. SOL MENÜ (SIDEBAR) - Coursie & AppDistro & Shopr Stili
   ============================================================================= */
.sidebar {
    width: 270px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 28px 20px;
    flex-shrink: 0;
    transition: var(--transition);
    z-index: 50;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
    padding-left: 8px;
}

.brand-logo-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    box-shadow: var(--shadow-pill);
}

.brand-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 18px 0 10px 12px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.nav-link:hover {
    background-color: var(--bg-card-subtle);
    color: var(--primary);
    transform: translateX(3px);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

[data-theme="dark"] .nav-link.active {
    background: rgba(88, 80, 236, 0.25);
    color: #fff;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
}

/* Sidebar Alt Kartı (Go Stars / Pro Banner) */
.sidebar-promo-card {
    margin-top: auto;
    background: linear-gradient(145deg, #1C1938 0%, #2A2458 100%);
    border-radius: var(--radius-lg);
    padding: 18px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(28, 25, 56, 0.35);
}

.sidebar-promo-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.35);
    filter: blur(20px);
}

.promo-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.promo-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
    line-height: 1.4;
}

.btn-promo {
    width: 100%;
    padding: 8px 12px;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-promo:hover {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

/* =============================================================================
   2. ANA İÇERİK ALANI (MAIN CONTENT)
   ============================================================================= */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
}

/* Üst Başlık & Kontrol Çubuğu (Top Navbar) */
.top-header {
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border-radius: var(--radius-pill);
    padding: 9px 18px;
    width: 340px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(88, 80, 236, 0.1);
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    width: 100%;
    margin-left: 8px;
}

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

/* Rol Seçici Kapsülü */
.role-badge-selector {
    display: flex;
    align-items: center;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 4px;
}

.role-btn {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.role-btn.active {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-pill);
}

/* Tema & Bildirim Butonları */
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 8px;
    border-left: 1px solid var(--border-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
}

.user-meta-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* İçerik Gövdesi */
.content-body {
    padding: 32px 36px 60px;
}

/* =============================================================================
   3. METRİK KARTLARI (KPI CARDS) - Coursie & Shopr Stili
   ============================================================================= */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.metric-card.highlight {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
}

.metric-card.highlight .metric-title,
.metric-card.highlight .metric-trend {
    color: rgba(255, 255, 255, 0.85);
}

.metric-card.highlight .metric-arrow {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.metric-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.metric-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.metric-arrow {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-pill);
    background: var(--bg-card-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--primary);
    font-weight: bold;
}

.metric-value {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.8px;
    margin-bottom: 8px;
}

.metric-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-emerald);
}

.trend-badge {
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-emerald);
    font-size: 11px;
}

/* =============================================================================
   4. SEKMELER & KART PANELLERİ
   ============================================================================= */
.tabs-nav-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-card);
}

.tab-content-panel {
    animation: tabFadeIn 0.15s ease-out;
}

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

/* Kart Panelleri */
.card-panel {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 28px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
}

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

.panel-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Buton Stilleri */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-pill);
}

.btn-primary:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-card-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

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

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

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

/* Modern Form Girdileri */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

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

.form-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(88, 80, 236, 0.12);
}

/* =============================================================================
   5. DİNAMİK PARÇA TABLOLARI
   ============================================================================= */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.modern-table th {
    background: var(--bg-card-subtle);
    color: var(--text-muted);
    font-weight: 700;
    text-align: left;
    padding: 12px 16px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 11px;
    border-bottom: 1px solid var(--border-color);
}

.modern-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    vertical-align: middle;
}

.modern-table tbody tr:last-child td {
    border-bottom: none;
}

.modern-table tbody tr:hover {
    background-color: var(--bg-card-subtle);
}

/* Rozet / Pill Stilleri */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
}

.badge-purple { background: rgba(88, 80, 236, 0.12); color: var(--primary); }
.badge-green  { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); }
.badge-amber  { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); }
.badge-pink   { background: rgba(236, 72, 153, 0.12); color: var(--accent-pink); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--accent-danger); }

/* =============================================================================
   6. CANLI KESİM KANVASI (1D & 2D CANVAS CONTAINER)
   ============================================================================= */
.canvas-wrapper {
    background: #0E0C22;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
    margin-top: 18px;
    position: relative;
    overflow-x: auto;
}

.canvas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    color: #fff;
}

.canvas-stats-strip {
    display: flex;
    gap: 16px;
    font-size: 12px;
}

.canvas-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 11px;
    color: #A09DC1;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

#canvas1D, #canvas2D {
    display: block;
    width: 100%;
    min-height: 380px;
    background: transparent;
    cursor: crosshair;
}

/* =============================================================================
   7. BLUETOOTH LAZER METRE & SAHA KİTİ
   ============================================================================= */
.laser-kit-card {
    background: linear-gradient(135deg, rgba(88, 80, 236, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
    border: 2px dashed rgba(88, 80, 236, 0.3);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.laser-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.laser-reading {
    font-size: 42px;
    font-weight: 900;
    font-family: monospace;
    color: var(--primary);
    letter-spacing: -1px;
}

.laser-unit {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-muted);
}

.ble-pulse {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* =============================================================================
   8. DİJİTAL İMZA KANVASI (MÜŞTERİ TESLİMİ)
   ============================================================================= */
.signature-box {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: #fff;
    cursor: crosshair;
    touch-action: none;
}

/* =============================================================================
   9. MODAL & TERMAL ETİKET ÖNİZLEME
   ============================================================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(14, 12, 34, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 30px;
    max-width: 620px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
}

/* Maliyet Verilerini Gizleme (Usta ve Montaj Rolünde) */
body.hide-financials .financial-data {
    display: none !important;
}

/* Responsive Düzen */
@media (max-width: 1024px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .sidebar {
        width: 80px;
        padding: 20px 12px;
    }
    .brand-title, .brand-subtitle, .nav-link span, .nav-section-title, .sidebar-promo-card {
        display: none;
    }
    .nav-link {
        justify-content: center;
        padding: 12px;
    }
}

@media (max-width: 640px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .top-header {
        padding: 14px 18px;
        flex-direction: column;
        gap: 12px;
    }
    .search-box {
        width: 100%;
    }
    .content-body {
        padding: 20px 16px;
    }
}
