/* CRM - Modern Dark Theme */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(18, 18, 26, 0.85);
    --bg-card-hover: rgba(24, 24, 36, 0.95);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f0f0f5;
    --text-secondary: #8b8b9e;
    --text-muted: #5a5a6e;
    --accent: #00d4aa;
    --accent-hover: #00b894;
    --accent-glow: rgba(0, 212, 170, 0.15);
    --danger: #ff4757;
    --warning: #ffa502;
    --info: #3742fa;
    --success: #2ed573;
    --sidebar-width: 260px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

/* Grid Background */
.grid-bg {
    background-color: var(--bg-primary);
    background-image:
        linear-gradient(rgba(0, 212, 170, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 170, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

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

.sidebar-brand .logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent), #00b4d8);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 18px; color: #0a0a0f;
}

.sidebar-brand h1 {
    font-size: 20px; font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #00b4d8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

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

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 14px; font-weight: 500;
    margin-bottom: 4px; transition: var(--transition);
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(0, 212, 170, 0.2);
}

.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex; align-items: center; gap: 12px;
    padding: 8px; border-radius: var(--radius-sm);
}

.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #00b4d8);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #0a0a0f;
    overflow: hidden; flex-shrink: 0;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-details { flex: 1; min-width: 0; }
.user-details .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-details .role { font-size: 11px; color: var(--text-muted); }

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

.page-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 50;
}

.page-header h2 { font-size: 24px; font-weight: 700; }
.page-header p { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }
.page-header > .btn { flex-shrink: 0; }

.page-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
}

.mobile-menu-btn svg { width: 22px; height: 22px; }

.mobile-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 10, 15, 0.95);
    position: sticky;
    top: 0;
    z-index: 60;
}

.mobile-topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99;
}

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

.alert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

button[disabled],
input[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

.page-body {
    padding: 24px 32px;
    min-width: 0;
    overflow-x: hidden;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.detail-grid > .card:only-child {
    grid-column: 1 / -1;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(8px);
    transition: var(--transition);
}

.card:hover { border-color: rgba(0, 212, 170, 0.15); }

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

.card-title { font-size: 16px; font-weight: 600; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #00b4d8);
}

.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-icon {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    opacity: 0.1; font-size: 48px;
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; border: none;
    cursor: pointer; transition: var(--transition);
    font-family: inherit; text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #00b4d8);
    color: #0a0a0f;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); color: #0a0a0f; }

.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }

.btn-danger { background: rgba(255, 71, 87, 0.15); color: var(--danger); border: 1px solid rgba(255, 71, 87, 0.3); }
.btn-danger:hover { background: rgba(255, 71, 87, 0.25); color: var(--danger); }

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

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }

.form-control {
    width: 100%; padding: 10px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 14px;
    font-family: inherit; transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

select.form-control {
    cursor: pointer;
    background-color: #12121a;
    color: var(--text-primary);
}

select.form-control option,
select.form-control optgroup {
    background-color: #ffffff;
    color: #0a0a0f;
}

select.form-control option:checked,
select.form-control option:hover {
    background-color: #00d4aa;
    color: #0a0a0f;
}

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

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

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left; padding: 12px 16px;
    font-size: 12px; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 14px 16px; font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Badges */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.3px;
}

.badge-success { background: rgba(46, 213, 115, 0.15); color: var(--success); }
.badge-warning { background: rgba(255, 165, 2, 0.15); color: var(--warning); }
.badge-danger { background: rgba(255, 71, 87, 0.15); color: var(--danger); }
.badge-info { background: rgba(55, 66, 250, 0.15); color: var(--info); }
.badge-accent { background: var(--accent-glow); color: var(--accent); }
.badge-muted { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

/* Alerts */
.alert {
    padding: 14px 18px; border-radius: var(--radius-sm);
    margin-bottom: 20px; font-size: 14px;
    display: flex; align-items: center; gap: 10px;
}

.alert-success { background: rgba(46, 213, 115, 0.1); border: 1px solid rgba(46, 213, 115, 0.2); color: var(--success); }
.alert-error { background: rgba(255, 71, 87, 0.1); border: 1px solid rgba(255, 71, 87, 0.2); color: var(--danger); }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none; align-items: center; justify-content: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow);
}

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

.modal-header h3 { font-size: 18px; font-weight: 600; }

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

.modal-close {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; padding: 4px; font-size: 20px;
}

/* Dashboard Kanban */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.kanban-column {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    min-height: 400px;
}

.kanban-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; gap: 12px;
}

.kanban-header .avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #00b4d8);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #0a0a0f;
}

.kanban-header .info h4 { font-size: 14px; font-weight: 600; }
.kanban-header .info span { font-size: 12px; color: var(--text-muted); }

.kanban-tasks { padding: 12px; display: flex; flex-direction: column; gap: 10px; max-height: 500px; overflow-y: auto; }

.task-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.task-card:hover { border-color: rgba(0, 212, 170, 0.3); transform: translateY(-1px); }
.task-card.overdue { border-left: 3px solid var(--danger); }
.task-card.due-soon { border-left: 3px solid var(--warning); }

.task-card h5 { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.task-card .task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.task-card .task-date { font-size: 11px; color: var(--text-muted); }

/* Customer Cards */
.customer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.customer-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    position: relative;
}

.customer-card:hover { border-color: rgba(0, 212, 170, 0.2); transform: translateY(-2px); }

.customer-card .customer-logo {
    width: 48px; height: 48px; border-radius: 10px;
    background: rgba(255,255,255,0.05);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; color: var(--accent);
    overflow: hidden; margin-bottom: 12px;
}

.customer-card .customer-logo img { width: 100%; height: 100%; object-fit: cover; }
.customer-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.customer-card .customer-info { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.customer-card .customer-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-primary);
    background-image:
        linear-gradient(rgba(0, 212, 170, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 170, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute; top: 20%; left: 50%; transform: translateX(-50%);
    width: 600px; height: 600px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    pointer-events: none;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    width: 100%; max-width: 420px;
    backdrop-filter: blur(12px);
    position: relative; z-index: 1;
    box-shadow: var(--shadow);
}

.login-card .brand { text-align: center; margin-bottom: 32px; }
.login-card .brand .logo-icon {
    width: 56px; height: 56px; margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--accent), #00b4d8);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 24px; color: #0a0a0f;
}

.login-card .brand h1 {
    font-size: 24px; font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #00b4d8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.login-card .brand p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* Filters */
.filters-bar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px; flex-wrap: wrap;
}

.filters-bar .form-control { width: auto; min-width: 180px; }

/* Pagination */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
    padding: 8px 14px; border-radius: var(--radius-sm);
    font-size: 13px; color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}
.pagination a:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.pagination .active span { background: var(--accent-glow); color: var(--accent); border-color: rgba(0,212,170,0.3); }

/* Empty State */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0,0,0,0.45);
    }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: inline-flex; }
    .mobile-topbar { display: flex; }
    .page-header {
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 16px;
        position: static;
    }
    .page-header > .btn,
    .page-header > a.btn {
        width: 100%;
        justify-content: center;
        order: 3;
    }
    .page-body { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .kanban-board { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .alert-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .customer-grid { grid-template-columns: 1fr; }

    .filters-bar .form-control {
        width: 100%;
        min-width: 0;
    }

    .filters-bar .btn {
        width: 100%;
        justify-content: center;
    }

    /* Mobil kart tablolar — sayfa kaymasını önler */
    .table-wrapper {
        border: none;
        overflow: visible;
    }

    .table-wrapper table {
        border: 0;
        width: 100%;
    }

    .table-wrapper thead {
        display: none;
    }

    .table-wrapper tbody,
    .table-wrapper tr,
    .table-wrapper td {
        display: block;
        width: 100%;
    }

    .table-wrapper tr {
        background: rgba(255,255,255,0.03);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        margin-bottom: 12px;
        padding: 12px 14px;
    }

    .table-wrapper tr:hover td {
        background: transparent;
    }

    .table-wrapper td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px solid rgba(255,255,255,0.06);
        font-size: 13px;
        text-align: right;
    }

    .table-wrapper td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .table-wrapper td:first-child {
        padding-top: 0;
    }

    .table-wrapper td::before {
        content: attr(data-label);
        flex-shrink: 0;
        font-size: 12px;
        font-weight: 600;
        color: var(--text-muted);
        text-align: left;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .table-wrapper td[data-label=""] {
        display: block;
    }

    .table-wrapper td[data-label=""]::before {
        display: none;
    }

    .table-wrapper .mobile-actions {
        width: 100%;
        justify-content: stretch;
    }

    .table-wrapper .mobile-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .card {
        overflow: hidden;
        max-width: 100%;
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Utility */
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Daily tasks */
.task-block {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.task-block:last-child { border-bottom: none; }

.task-block-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

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

.daily-log {
    margin-top: 14px;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.daily-log-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 10px;
}

.daily-log-item {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
    margin-bottom: 8px;
}

.daily-log-item:last-child { margin-bottom: 0; }
.daily-log-item.is-done { border-color: rgba(46, 213, 115, 0.2); }
.daily-log-item.is-locked { opacity: 0.75; }

.daily-log-date {
    flex: 1;
    min-width: 140px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.daily-log-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .task-block-main { flex-direction: column; }
    .task-block-main > .flex { width: 100%; }
    .task-block-main > .flex .btn { flex: 1; justify-content: center; }
    .daily-log-item { flex-direction: column; align-items: stretch; }
    .daily-log-actions .btn { flex: 1; justify-content: center; }
}
