/* ===== Orbita CRM - Modern Tema ===== */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg: #f5f6fa;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 4px 12px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.08);
    --radius: 10px;
    --radius-sm: 6px;
    --sidebar-w: 250px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    color: #e0e7ff;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    z-index: 100;
}
.brand {
    display: flex; align-items: center; gap: 12px;
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-logo {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    display: grid; place-items: center;
    font-weight: 700; font-size: 20px;
    color: white;
}
.brand-text { font-weight: 700; font-size: 16px; letter-spacing: 0.5px; color: white; }

.nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: #c7d2fe;
    margin-bottom: 4px;
    font-size: 14px;
    transition: all .15s;
}
.nav a:hover { background: rgba(255,255,255,.08); color: white; }
.nav a.active {
    background: rgba(129,140,248,.2);
    color: white;
    font-weight: 500;
}
.nav-icon { width: 20px; text-align: center; opacity: 0.9; }

.sidebar-footer {
    padding: 16px 16px 0;
    border-top: 1px solid rgba(255,255,255,.1);
}
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f472b6, #c084fc);
    display: grid; place-items: center;
    font-weight: 700; color: white;
}
.user-name { font-size: 13px; color: white; font-weight: 500; }
.user-role { font-size: 11px; color: #a5b4fc; text-transform: capitalize; }
.logout-btn {
    display: block;
    margin-top: 12px;
    text-align: center;
    background: rgba(255,255,255,.08);
    color: white !important;
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.logout-btn:hover { background: rgba(239,68,68,.3); }

/* ===== Main ===== */
.main-content {
    margin-left: var(--sidebar-w);
    padding: 32px 36px;
    min-height: 100vh;
}
.main-content--full { padding: 0; min-height: 100vh; }

.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
}
.page-header h1 { font-size: 24px; font-weight: 700; color: var(--text); }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; }

/* ===== Flash ===== */
.flash-container { margin-bottom: 16px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 14px;
    border: 1px solid;
}
.flash-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.flash-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.link { color: var(--primary); font-size: 13px; }

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.stat-primary {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    border: none;
}
.stat-primary .stat-label { color: rgba(255,255,255,.85); }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
    text-align: center;
}
.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.btn-ghost:hover { background: #f9fafb; color: var(--text); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ===== Forms ===== */
.form { display: block; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 20px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group-full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
    color: var(--text);
    transition: border .15s, box-shadow .15s;
    font-family: inherit;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-error { color: var(--danger); font-size: 12px; }
.form-hint { color: var(--text-muted); font-size: 12px; }
.form-check { flex-direction: row; align-items: center; gap: 8px; }
.form-check label { font-weight: normal; cursor: pointer; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ===== Filters ===== */
.filters-bar {
    display: grid;
    grid-template-columns: 1.5fr repeat(6, 1fr) auto auto;
    gap: 8px;
    margin-bottom: 16px;
    background: var(--surface);
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: #f9fafb;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.data-table tr:hover { background: #fafbfc; }
.data-table tr:last-child td { border-bottom: none; }
.lead-name { font-weight: 500; color: var(--text); }
.lead-name:hover { color: var(--primary); }
.actions { display: flex; gap: 6px; white-space: nowrap; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th { text-align: left; padding: 8px 0; color: var(--text-muted); font-weight: 600; font-size: 12px; }
.mini-table td { padding: 8px 0; border-top: 1px solid var(--border); }

/* ===== Badges and tags ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: #eef2ff;
    color: var(--primary-dark);
}
.badge-0 { background: #fef3c7; color: #92400e; }
.badge-1 { background: #dbeafe; color: #1e40af; }
.badge-2 { background: #ede9fe; color: #5b21b6; }
.badge-3 { background: #d1fae5; color: #065f46; }
.badge-4 { background: #fce7f3; color: #9d174d; }
.badge-5 { background: #fee2e2; color: #991b1b; }
.badge-kurumsal { background: #1e3a8a; color: white; }
.badge-bireysel { background: #ecfeff; color: #0e7490; border: 1px solid #67e8f9; }
.badge-ulasilamaz { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Contact-channel icons (lead list / kanban) */
.contact-icons { display: flex; gap: 4px; flex-wrap: wrap; }
.contact-icons .ch {
    display: inline-block;
    line-height: 1;
    font-size: 16px;
    cursor: help;
    filter: grayscale(.15);
}
.contact-icons .ch:hover { filter: none; }

.form-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin: 16px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.form-section-title:first-child { margin-top: 0; }

/* ===== Bulk action bar ===== */
.col-check { width: 32px; text-align: center; }
.col-check input[type="checkbox"] { cursor: pointer; }

.bulk-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-light);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.bulk-bar-left { display: flex; align-items: center; gap: 10px; }
.bulk-count {
    background: var(--primary);
    color: white;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 13px;
}

.bulk-dropdown { position: relative; }
.bulk-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    padding: 6px;
    z-index: 30;
}
.bulk-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
}
.bulk-menu-item:hover:not(:disabled) { background: var(--primary-light); color: var(--primary-dark); }
.bulk-menu-disabled { color: var(--text-light); cursor: not-allowed; }

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close {
    background: none; border: none; font-size: 22px; cursor: pointer;
    color: var(--text-muted); line-height: 1;
}
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-body label { font-size: 13px; font-weight: 500; display: block; margin-bottom: 6px; }
.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    background: #f3f4f6;
    color: var(--text-muted);
    font-weight: 500;
}
.tag-light { background: #eef2ff; color: var(--primary); }

.muted { color: var(--text-muted); font-size: 12px; }
.empty { color: var(--text-light); text-align: center; padding: 24px 0; font-size: 13px; }

/* ===== Pagination ===== */
.pagination {
    display: flex; justify-content: center; align-items: center; gap: 16px;
    margin-top: 20px;
    font-size: 13px;
}
.pagination a {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { color: var(--text-muted); }

/* ===== Grid layouts ===== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .filters-bar { grid-template-columns: 1fr 1fr; }
}

/* ===== Distribution List (dashboard) ===== */
.dist-list { list-style: none; }
.dist-list li {
    display: grid;
    grid-template-columns: 80px 1fr 40px;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
}
.dist-bar {
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    display: block;
}
.dist-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
}
.dist-value { text-align: right; color: var(--text-muted); font-weight: 600; }

/* ===== Info List (lead detail) ===== */
.info-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 16px;
    font-size: 13px;
}
.info-list dt { color: var(--text-muted); font-weight: 500; }
.info-list dd { color: var(--text); }
.notes { white-space: pre-wrap; line-height: 1.6; font-size: 14px; }

/* ===== Timeline ===== */
.timeline { list-style: none; }
.timeline li {
    padding: 10px 0 10px 18px;
    border-left: 2px solid var(--border);
    position: relative;
    margin-left: 8px;
}
.timeline li::before {
    content: '';
    width: 10px; height: 10px;
    background: var(--primary);
    border-radius: 50%;
    position: absolute;
    left: -6px; top: 14px;
}
.timeline-time { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-content { font-size: 13px; }

/* ===== Kanban ===== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(6, minmax(220px, 1fr));
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.kanban-col {
    background: #f3f4f6;
    border-radius: var(--radius);
    padding: 12px;
    min-height: 400px;
}
.kanban-col-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
    padding: 0 4px;
}
.kanban-title { font-size: 13px; font-weight: 600; color: var(--text); }
.kanban-count {
    background: white;
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.kanban-list {
    display: flex; flex-direction: column; gap: 8px;
    min-height: 200px;
    transition: background .15s;
    border-radius: var(--radius-sm);
    padding: 4px;
}
.kanban-list.drag-over { background: #e0e7ff; }
.kanban-card {
    background: white;
    padding: 12px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    cursor: grab;
    transition: transform .1s, box-shadow .15s;
}
.kanban-card:hover { box-shadow: var(--shadow); }
.kanban-card.dragging { opacity: 0.4; transform: rotate(2deg); }
.kanban-card-name a { color: var(--text); font-weight: 600; font-size: 13px; }
.kanban-card-name a:hover { color: var(--primary); }
.kanban-card-meta { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
.kanban-card-info { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 1280px) {
    .kanban-board { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
}

/* ===== Login ===== */
.login-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
    padding: 20px;
}
.login-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo {
    width: 64px; height: 64px;
    margin: 0 auto 12px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: grid; place-items: center;
    font-size: 32px; color: white; font-weight: 700;
}
.login-brand h1 { font-size: 22px; }
.login-brand p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-card .form-group { margin-bottom: 16px; }
.login-hint {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
}
.login-hint code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* ===== Misc ===== */
.bullet { padding-left: 20px; line-height: 1.8; font-size: 13px; }
code {
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: "Courier New", monospace;
    font-size: 12px;
    color: var(--primary-dark);
}
