/*
 * Psikowell — Ana Tema
 * Kurumsal · Sade · Klinik güven
 *
 * TEK DOĞRU KAYNAK: aşağıdaki :root bloğu.
 * Yeni renk/spacing ICAT ETMEYİN — bu token'ları kullanın.
 * Her component light + dark + mobil doğrulanır.
 */

/* ===== GOOGLE FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===== TASARIM TOKEN'LARI ===== */
:root {
    /* — Marka: Psikowell yeşili — */
    --primary: #3F7A68;
    --primary-dark: #2C5648;
    --primary-soft: #6FA292;
    --primary-lighter: #A9C9BC;
    --primary-bg: #EEF4F0;
    --primary-gradient: linear-gradient(135deg, #2C5648 0%, #3F7A68 55%, #6FA292 100%);
    --primary-glow: 0 0 0 4px rgba(63, 122, 104, 0.12);

    /* — Premium vurgu (ajans / kurumsal) — */
    --accent-gold: #B8925A;
    --accent-gold-bg: #FBF7F0;

    /* — Yüzeyler — */
    --surface: #FFFFFF;
    --surface-alt: #F6F8F7;
    --surface-hover: #EEF4F0;
    --surface-sunken: #EDF1EF;
    --border: #E2E8E5;
    --border-strong: #CBD8D2;

    /* — Metin — */
    --text-primary: #1B2B26;
    --text-secondary: #5A6B65;
    --text-muted: #8A9994;
    --text-on-primary: #FFFFFF;

    /* — Durum renkleri — */
    --success: #2E7D5B;
    --success-bg: #EAF5EF;
    --danger: #C0392B;
    --danger-bg: #FBEDEC;
    --warning: #B7791F;
    --warning-bg: #FDF6E7;
    --info: #2C6E9B;
    --info-bg: #EBF3F9;

    /* — Gölgeler: nötr, yumuşak (kurumsal derinlik) — */
    --shadow-sm: 0 1px 2px rgba(27, 43, 38, 0.05);
    --shadow-md: 0 2px 8px rgba(27, 43, 38, 0.06);
    --shadow-lg: 0 8px 24px rgba(27, 43, 38, 0.08);
    --shadow-xl: 0 16px 40px rgba(27, 43, 38, 0.10);

    /* — Yüzey efekti: düz + ince kenar (ağır glass yok) — */
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(27, 43, 38, 0.08);
    --glass-blur: blur(12px);

    /* — Yerleşim — */
    --sidebar-width: 264px;
    --sidebar-collapsed: 76px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    /* — Hareket: ölçülü, abartısız — */
    --transition-fast: 120ms ease;
    --transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 380ms cubic-bezier(0.4, 0, 0.2, 1);
    --spring: 420ms cubic-bezier(0.34, 1.4, 0.64, 1);

    /* — Tipografi — */
    --font-heading: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ===== KOYU TEMA ===== */
[data-theme="dark"] {
    --primary: #6FA292;
    --primary-dark: #3F7A68;
    --primary-soft: #4E8C77;
    --primary-lighter: #2C5648;
    --primary-bg: #16241F;
    --primary-gradient: linear-gradient(135deg, #2C5648 0%, #3F7A68 55%, #6FA292 100%);
    --primary-glow: 0 0 0 4px rgba(111, 162, 146, 0.18);

    --accent-gold: #D0AA72;
    --accent-gold-bg: #241E14;

    --surface: #16211D;
    --surface-alt: #101815;
    --surface-hover: #1D2C26;
    --surface-sunken: #0C1310;
    --border: #263631;
    --border-strong: #354841;

    --text-primary: #E8EFEB;
    --text-secondary: #A3B3AD;
    --text-muted: #74847E;
    --text-on-primary: #0C1310;

    --success: #5BB98B;
    --success-bg: rgba(91, 185, 139, 0.12);
    --danger: #E57366;
    --danger-bg: rgba(229, 115, 102, 0.12);
    --warning: #E0B056;
    --warning-bg: rgba(224, 176, 86, 0.12);
    --info: #6BA8D4;
    --info-bg: rgba(107, 168, 212, 0.12);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.55);

    --glass-bg: rgba(22, 33, 29, 0.92);
    --glass-border: rgba(232, 239, 235, 0.08);
}

/* ===== GLOBAL RESET ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--surface-alt);
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-soft);
}

img {
    max-width: 100%;
    display: block;
}

/* ===== LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.page-content {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width var(--transition), transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-brand .brand-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
    box-shadow: var(--primary-glow);
}

.sidebar-brand .brand-text h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-brand .brand-text span {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 12px 16px 8px;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    transition: height var(--transition);
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::before {
    height: 60%;
}

.nav-item .nav-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    min-width: 22px;
    text-align: center;
}

/* Sidebar User Card */
.sidebar-user {
    padding: 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    transition: background var(--transition-fast);
}

.sidebar-user-card:hover {
    background: var(--surface-hover);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-family: var(--font-heading);
    font-size: 16px;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-info .user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* ===== HEADER / TOP BAR ===== */
.top-bar {
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 18px;
    transition: all var(--transition-fast);
    position: relative;
}

.top-bar-btn:hover {
    background: var(--surface-hover);
    color: var(--primary);
    border-color: var(--primary-soft);
}

.top-bar-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--surface);
}

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== KPI STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: var(--primary-gradient);
    opacity: 0.03;
    border-radius: 0 0 0 100%;
    transition: opacity var(--transition);
}

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

.stat-card:hover::after {
    opacity: 0.06;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.pink {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-icon.green {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.blue {
    background: var(--info-bg);
    color: var(--info);
}

.stat-icon.orange {
    background: var(--warning-bg);
    color: var(--warning);
}

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

.stat-info .stat-value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-info .stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--text-on-primary);
    box-shadow: 0 4px 16px rgba(63, 122, 104, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(63, 122, 104, 0.4);
    color: white;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: #DC2626;
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.4);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: #059669;
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--primary);
}

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

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

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

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-soft);
    box-shadow: 0 0 0 4px rgba(63, 122, 104, 0.08);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

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

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead th {
    background: var(--surface-alt);
    padding: 14px 16px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

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

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--surface-hover);
}

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

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-primary {
    background: var(--primary-bg);
    color: var(--primary);
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

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

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 90%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.95);
    transition: transform var(--spring);
    box-shadow: var(--shadow-xl);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

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

.modal-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--surface-alt);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ===== TOAST / ALERT ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 14px;
    min-width: 300px;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.4s var(--spring);
    border-left: 4px solid;
}

.toast-success {
    background: var(--success-bg);
    color: #065F46;
    border-color: var(--success);
}

.toast-error {
    background: var(--danger-bg);
    color: #991B1B;
    border-color: var(--danger);
}

.toast-warning {
    background: var(--warning-bg);
    color: #92400E;
    border-color: var(--warning);
}

.toast-info {
    background: var(--info-bg);
    color: #1E40AF;
    border-color: var(--info);
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success { background: var(--success-bg); color: #065F46; border-color: var(--success); }
.alert-danger { background: var(--danger-bg); color: #991B1B; border-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: #92400E; border-color: var(--warning); }
.alert-info { background: var(--info-bg); color: #1E40AF; border-color: var(--info); }

/* ===== SEARCH BAR ===== */
.search-bar {
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
    transition: all var(--transition-fast);
    outline: none;
}

.search-bar input:focus {
    border-color: var(--primary-soft);
    box-shadow: 0 0 0 4px rgba(63, 122, 104, 0.08);
}

.search-bar .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ===== BALANCE INDICATOR ===== */
.balance-positive {
    color: var(--danger);
    font-weight: 700;
}

.balance-zero {
    color: var(--success);
    font-weight: 600;
}

.balance-negative {
    color: var(--info);
    font-weight: 600;
}

/* ===== TRANSACTION TIMELINE ===== */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
    animation: fadeInUp 0.4s ease forwards;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -23px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid;
    background: var(--surface);
}

.timeline-item.borc::before {
    border-color: var(--danger);
}

.timeline-item.odeme::before {
    border-color: var(--success);
}

.timeline-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: all var(--transition-fast);
}

.timeline-content:hover {
    box-shadow: var(--shadow-md);
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.page-btn {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.page-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary-soft);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== CHART ===== */
.chart-container {
    position: relative;
    padding: 20px 0;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 200px;
    padding: 0 10px;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 100%;
    max-width: 48px;
    border-radius: 8px 8px 4px 4px;
    background: var(--primary-gradient);
    transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 4px;
    position: relative;
    cursor: pointer;
}

.bar:hover {
    opacity: 0.85;
    transform: scaleX(1.05);
}

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

.bar-value {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.5s ease forwards; }
.animate-scale-in { animation: scaleIn 0.4s var(--spring) forwards; }

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }

/* ===== SKELETON LOADER ===== */
.skeleton {
    background: linear-gradient(90deg, var(--surface-alt) 25%, var(--surface-hover) 50%, var(--surface-alt) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ===== UTILITIES ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar, .top-bar, .no-print, .btn { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    body { background: white !important; color: black !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .page-content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .top-bar {
        padding: 0 16px;
    }

    .page-content {
        padding: 16px;
    }

    .modal {
        width: 95%;
        padding: 24px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-info .stat-value {
        font-size: 24px;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 10px 12px;
    }

    .bar-chart {
        gap: 8px;
    }
}

/* ===== SIDEBAR OVERLAY (Mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

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

/* ===== TOOLBAR / ACTION BAR ===== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

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

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== APPOINTMENT CALENDAR ===== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-header {
    padding: 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.calendar-day {
    min-height: 100px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.calendar-day:hover {
    background: var(--surface-hover);
    border-color: var(--primary-soft);
}

.calendar-day.today {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day .day-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.calendar-day.today .day-number {
    color: var(--primary);
}

.calendar-event {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event.planlanmis {
    background: var(--info-bg);
    color: var(--info);
}

.calendar-event.tamamlandi {
    background: var(--success-bg);
    color: var(--success);
}

.calendar-event.iptal {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ===== VIEW TOGGLE ===== */
.view-toggle {
    display: inline-flex;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 2px;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.view-toggle-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* ===== DAY GROUP (Appointment List) ===== */
.day-group {
    margin-bottom: 28px;
    animation: fadeInUp 0.4s ease forwards;
}

.day-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.day-group-header .day-date {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.day-group-header .day-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.day-group-header .day-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.day-group.is-today .day-group-header {
    border-bottom-color: var(--primary);
}

.day-group.is-today .day-date {
    color: var(--primary);
}

/* ===== APPOINTMENT CARD ===== */
.appointment-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: all var(--transition-fast);
}

.appointment-card:hover {
    border-color: var(--primary-soft);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.appointment-card .appt-time {
    min-width: 60px;
    text-align: center;
}

.appointment-card .appt-time .time-value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.appointment-card .appt-time .time-period {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.appointment-card .appt-divider {
    width: 3px;
    height: 40px;
    border-radius: 2px;
    background: var(--border-strong);
    flex-shrink: 0;
}

.appointment-card .appt-divider.planlanmis { background: var(--info); }
.appointment-card .appt-divider.tamamlandi { background: var(--success); }
.appointment-card .appt-divider.iptal { background: var(--danger); }

.appointment-card .appt-info {
    flex: 1;
    min-width: 0;
}

.appointment-card .appt-client {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 4px;
    text-decoration: none;
    display: block;
}

.appointment-card .appt-client:hover {
    color: var(--primary);
}

.appointment-card .appt-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.appointment-card .appt-meta .duration-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.appointment-card .appt-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.appointment-card .appt-status.planlanmis {
    background: var(--info-bg);
    color: var(--info);
}

.appointment-card .appt-status.tamamlandi {
    background: var(--success-bg);
    color: var(--success);
}

.appointment-card .appt-status.iptal {
    background: var(--danger-bg);
    color: var(--danger);
}

.appointment-card .appt-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.appointment-card .appt-actions .action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.appointment-card .appt-actions .action-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary-soft);
}

.appointment-card .appt-actions .action-btn.complete:hover {
    background: var(--success-bg);
    border-color: var(--success);
    color: var(--success);
}

.appointment-card .appt-actions .action-btn.cancel:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

.appointment-card .appt-actions .action-btn.delete:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

/* Appointment Card Notes */
.appointment-card .appt-notes {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 2px;
}

/* List Empty State */
.list-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.list-empty-state .empty-emoji {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.list-empty-state h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.list-empty-state p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 640px) {
    .appointment-card {
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px;
    }

    .appointment-card .appt-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid var(--border);
    }

    .view-toggle-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* ===== TAB NAVIGATION ===== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* ===== DROPDOWN ===== */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--transition-fast);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    transition: background var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--surface-hover);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-strong);
    border-radius: var(--radius-full);
    transition: all var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ===== CLIENT CARD VIEW ===== */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.client-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition);
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.client-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-soft);
}

.client-card .client-avatar {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-family: var(--font-heading);
    font-size: 20px;
    margin-bottom: 16px;
}

.client-card .client-name {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.client-card .client-phone {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.client-card .client-balance {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.filter-bar .form-control {
    max-width: 200px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-chip:hover,
.filter-chip.active {
    background: var(--primary-bg);
    border-color: var(--primary-soft);
    color: var(--primary);
}

/* ============================================================
   CLIENTS / TABLO MOBILE RESPONSIVE (2026-05-07)
   ============================================================ */

/* Tablet ve altı: toolbar stack */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .toolbar-left,
    .toolbar-right {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }
    .toolbar-left .search-bar {
        flex: 1 1 100%;
        max-width: none !important;
    }
    .toolbar-left > .flex {
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 6px !important;
    }
    .toolbar-right {
        justify-content: space-between;
        align-items: center;
    }
    .toolbar-right .view-toggle {
        flex: 1 1 auto;
    }
    .toolbar-right .btn {
        flex: 0 0 auto;
    }
    .filter-chip {
        flex: 1 1 auto;
        min-width: max-content;
        text-align: center;
        white-space: nowrap;
        font-size: 13px;
        padding: 6px 12px;
    }

    /* Clients grid mobilde tek sütun */
    .clients-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
}

/* Telefon: tabloyu kart formatına çevir */
@media (max-width: 600px) {
    .table-container {
        overflow-x: visible;
        background: transparent;
        border: none;
    }
    .data-table {
        background: transparent;
        border-collapse: separate;
        border-spacing: 0 12px;
    }
    .data-table thead {
        display: none;
    }
    .data-table tbody tr {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 14px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    }
    .data-table tbody tr:hover {
        background: var(--surface);
        transform: none;
    }
    .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 6px 0 !important;
        border: none !important;
        text-align: right;
    }
    .data-table tbody td:first-child {
        padding-bottom: 10px !important;
        margin-bottom: 6px;
        border-bottom: 1px dashed var(--border) !important;
        justify-content: flex-start;
        text-align: left;
    }
    .data-table tbody td:first-child::before {
        content: none !important;
    }
    .data-table tbody td::before {
        content: attr(data-label);
        font-size: 11.5px;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.4px;
        flex: 0 0 auto;
    }
    /* Aksiyon butonları kart altında full-width */
    .data-table tbody td.actions-cell {
        flex-wrap: wrap;
        justify-content: flex-end;
        padding-top: 10px !important;
        margin-top: 6px;
        border-top: 1px dashed var(--border) !important;
    }
    .data-table tbody td.actions-cell::before {
        content: none;
    }
    .data-table tbody td.actions-cell .flex {
        flex: 1 1 100%;
        gap: 8px !important;
    }
    .data-table tbody td.actions-cell .btn {
        flex: 1;
    }
}

/* Çok küçük ekranlar (<400px): chip ve buton metni daha kompakt */
@media (max-width: 400px) {
    .filter-chip {
        font-size: 12px;
        padding: 5px 10px;
    }
    .view-toggle-btn {
        padding: 5px 8px;
        font-size: 11.5px;
    }
    .toolbar-right .btn {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* ============================================================
   STATS GRID + FILTER BAR + MMPI/SCL90 SAYFALARI MOBILE FIX
   ============================================================ */

.scl-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.scl-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px;
}
/* Pasif (ghost) filtre butonları görünür pill olsun — dark mode'da da net */
.scl-filter-bar .btn {
    flex: 0 1 auto;
    font-weight: 600;
}
.scl-filter-bar .btn-ghost {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.scl-filter-bar .btn-ghost:hover {
    background: var(--primary-bg);
    border-color: var(--primary-soft);
    color: var(--primary);
}

@media (max-width: 600px) {
    .scl-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .scl-stats-grid .stat-card {
        padding: 14px 12px;
    }
    .scl-stats-grid .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }
    .scl-stats-grid .stat-value {
        font-size: 22px;
    }
    .scl-stats-grid .stat-label {
        font-size: 12px;
    }
}

@media (max-width: 380px) {
    .scl-stats-grid {
        grid-template-columns: 1fr;
    }
}


/* MMPI ve SCL90 .table sınıfı için de mobil kart formatı (data-table ile aynı) */
@media (max-width: 600px) {
    .table.data-table {
        background: transparent;
        border-collapse: separate;
        border-spacing: 0 12px;
    }
    .table.data-table thead {
        display: none;
    }
    .table.data-table tbody tr {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 14px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    }
    .table.data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 6px 0 !important;
        border: none !important;
        text-align: right !important;
        white-space: normal !important;
    }
    .table.data-table tbody td:first-child {
        padding-bottom: 10px !important;
        margin-bottom: 6px;
        border-bottom: 1px dashed var(--border) !important;
        justify-content: flex-start;
        text-align: left !important;
    }
    .table.data-table tbody td:first-child::before {
        content: none !important;
    }
    .table.data-table tbody td::before {
        content: attr(data-label);
        font-size: 11.5px;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.4px;
        flex: 0 0 auto;
    }
    .table.data-table tbody td.actions-cell {
        flex-wrap: wrap;
        justify-content: flex-end;
        padding-top: 10px !important;
        margin-top: 6px;
        border-top: 1px dashed var(--border) !important;
    }
    .table.data-table tbody td.actions-cell::before {
        content: none;
    }
}

/* Page header subtitle mobilde küçült */
@media (max-width: 480px) {
    .page-content > h1,
    .top-bar h1 {
        font-size: 22px;
    }
    .page-subtitle,
    .top-bar p {
        font-size: 12.5px;
    }
}

/* ============================================================
   MOBILE DEFENSIVE OVERRIDES (2026-05-07 v3)
   Browser cache + grid shrink + tablo kart formati zorlama
   ============================================================ */

/* Body/main-content yatay tasimani onle */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw;
    }
    .app-layout,
    .main-content,
    .page-content {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    /* Card ve grid items shrink olabilsin */
    .stat-card,
    .feature-card,
    .card,
    .scl-stats-grid > *,
    .stats-grid > *,
    .clients-grid > * {
        min-width: 0 !important;
        max-width: 100%;
    }
    .stat-card {
        padding: 16px !important;
        gap: 12px !important;
    }
    .stat-card .stat-value {
        font-size: 22px !important;
        word-break: break-word;
    }
}

/* Tablo kart formatini ZORLA — !important ile (specificity savasini bitir) */
@media (max-width: 600px) {
    .table.data-table,
    table.data-table,
    .table-container .table.data-table {
        background: transparent !important;
        border-collapse: separate !important;
        border-spacing: 0 12px !important;
        width: 100% !important;
        display: block !important;
    }
    .table.data-table thead {
        display: none !important;
    }
    .table.data-table tbody {
        display: block !important;
        width: 100% !important;
    }
    .table.data-table tbody tr {
        display: block !important;
        width: 100% !important;
        background: var(--surface) !important;
        border: 1px solid var(--border) !important;
        border-radius: 14px !important;
        padding: 14px !important;
        margin-bottom: 12px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    }
    .table.data-table tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 6px 0 !important;
        border: none !important;
        text-align: right !important;
        white-space: normal !important;
        width: 100% !important;
    }
    .table.data-table tbody td:first-child {
        padding-bottom: 10px !important;
        margin-bottom: 6px;
        border-bottom: 1px dashed var(--border) !important;
        justify-content: flex-start !important;
        text-align: left !important;
    }
    .table.data-table tbody td:first-child::before {
        content: none !important;
    }
    .table.data-table tbody td::before {
        content: attr(data-label) !important;
        font-size: 11.5px !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        color: var(--text-muted) !important;
        letter-spacing: 0.4px !important;
        flex: 0 0 auto !important;
    }
    .table.data-table tbody td.actions-cell {
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
        padding-top: 10px !important;
        margin-top: 6px;
        border-top: 1px dashed var(--border) !important;
    }
    .table.data-table tbody td.actions-cell::before {
        content: none !important;
    }
    .table-container {
        overflow-x: visible !important;
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
    }
    /* Page header esnek wrap */
    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .page-header > div {
        width: 100% !important;
    }
    .page-header p {
        max-width: 100% !important;
        word-wrap: break-word;
    }
}

/* Filter bar mobilde wrap zorla (clients vb.) */
@media (max-width: 600px) {
    .filter-bar {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        overflow-x: visible !important;
    }
    .filter-bar .btn {
        flex: 1 1 auto !important;
        min-width: max-content !important;
        font-size: 12.5px !important;
        padding: 6px 10px !important;
    }
}

/* SCL/MMPI filtre çubuğu mobilde tam genişlik dikey stack — alt alta, şık pill butonlar */
@media (max-width: 600px) {
    .scl-filter-bar {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 10px !important;
        overflow-x: visible !important;
    }
    .scl-filter-bar .btn {
        flex: unset !important;
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
        font-size: 13.5px !important;
        padding: 11px 12px !important;
    }
}

/* Stats grid 380px alti tek sutun + 600px alti 2 sutun ZORLA */
@media (max-width: 600px) {
    .scl-stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
}
@media (max-width: 480px) {
    .scl-stats-grid {
        grid-template-columns: 1fr !important;
    }
}
