@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* Sidebar */
    --sidebar-bg: #0a1628;
    --sidebar-hover: #132240;
    --sidebar-active: #1a3059;
    --sidebar-text: #8899b4;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;
    
    /* Main */
    --bg-primary: #f0f4f8;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    
    /* Text */
    --text-primary: #1a2332;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Accent Colors */
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    
    /* Profit/Loss */
    --profit: #10b981;
    --profit-bg: rgba(16, 185, 129, 0.1);
    --loss: #ef4444;
    --loss-bg: rgba(239, 68, 68, 0.1);
    
    /* Borders & Shadows */
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ======= SIDEBAR ======= */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo .logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: white;
    font-weight: 800;
}

.sidebar-logo h1 {
    font-size: 16px;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.sidebar-logo small {
    font-size: 11px;
    color: var(--sidebar-text);
    font-weight: 400;
}

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

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--sidebar-text);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 2px;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    opacity: 0.7;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text);
    font-size: 13px;
}

.sidebar-user .avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 13px;
}

/* ======= MAIN CONTENT ======= */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 0;
}

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

.topbar h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-content {
    padding: 28px 32px;
}

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

.summary-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.summary-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
}

.summary-card.blue::before { background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan)); }
.summary-card.green::before { background: linear-gradient(90deg, var(--accent-green), #34d399); }
.summary-card.orange::before { background: linear-gradient(90deg, var(--accent-orange), #fbbf24); }
.summary-card.purple::before { background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink)); }
.summary-card.red::before { background: linear-gradient(90deg, var(--accent-red), #f87171); }

.summary-card .card-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.summary-card .card-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 4px;
}

.summary-card .card-sub {
    font-size: 13px;
    color: var(--text-muted);
}

/* ======= TABLE ======= */
.data-table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

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

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

.table-filters {
    display: flex;
    gap: 8px;
    align-items: center;
}

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

.data-table thead th {
    background: #f8fafc;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

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

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

.data-table .mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
}

.data-table .hisse-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
}

.hisse-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.kisi-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.kisi-tag.huseyin { background: rgba(59,130,246,0.1); color: var(--accent-blue); }
.kisi-tag.cocuklar { background: rgba(139,92,246,0.1); color: var(--accent-purple); }
.kisi-tag.tugce { background: rgba(236,72,153,0.1); color: var(--accent-pink); }
.kisi-tag.kredi { background: rgba(245,158,11,0.1); color: var(--accent-orange); }
.kisi-tag.kurban { background: rgba(6,182,212,0.1); color: var(--accent-cyan); }

/* ======= PROFIT/LOSS ======= */
.text-profit { color: var(--profit); font-weight: 600; }
.text-loss { color: var(--loss); font-weight: 600; }
.bg-profit { background: var(--profit-bg); color: var(--profit); }
.bg-loss { background: var(--loss-bg); color: var(--loss); }

.profit-badge, .loss-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

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

/* ======= BUTTONS ======= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(59,130,246,0.4); transform: translateY(-1px); }

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: white;
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}
.btn-success:hover { box-shadow: 0 4px 16px rgba(16,185,129,0.4); transform: translateY(-1px); }

.btn-warning {
    background: linear-gradient(135deg, var(--accent-orange), #d97706);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { background: var(--bg-card-hover); border-color: var(--accent-blue); color: var(--accent-blue); }

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

.btn-icon {
    width: 36px; height: 36px;
    padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

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

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='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

/* ======= MODAL ======= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 22, 40, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.25s ease;
}

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

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

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

.modal-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover { background: #f1f5f9; color: var(--text-primary); }

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

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

.alert-success { background: var(--profit-bg); color: #065f46; border: 1px solid rgba(16,185,129,0.2); }
.alert-error { background: var(--loss-bg); color: #991b1b; border: 1px solid rgba(239,68,68,0.2); }
.alert-info { background: rgba(59,130,246,0.1); color: #1e40af; border: 1px solid rgba(59,130,246,0.2); }

/* ======= LOADING ======= */
.spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    z-index: 10;
}

/* ======= DISTRIBUTION PREVIEW ======= */
.dist-preview {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 12px;
}

.dist-preview h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dist-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.dist-row:last-child { border-bottom: none; }

.dist-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    flex: 1;
    margin: 0 12px;
    overflow: hidden;
}

.dist-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    transition: width 0.3s;
}

/* ======= LOGIN PAGE ======= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-bg);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px;
}

.login-card .logo-section {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .logo-section .logo-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
    border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px;
    color: white;
    font-weight: 800;
    margin-bottom: 16px;
}

.login-card h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
}

.login-card .subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

/* ======= RESPONSIVE ======= */
.mobile-toggle {
    display: none;
    width: 40px; height: 40px;
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: flex; align-items: center; justify-content: center; }
    .page-content { padding: 20px 16px; }
    .topbar { padding: 12px 16px; }
    .summary-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .summary-card { padding: 16px; }
    .summary-card .card-value { font-size: 22px; }
    .form-row { grid-template-columns: 1fr; }
    .data-table { font-size: 13px; }
    .data-table thead th, .data-table tbody td { padding: 10px 12px; }
}

/* ======= TAB NAV ======= */
.tab-nav {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ======= TOOLTIP ======= */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--sidebar-bg);
    color: white;
    font-size: 11px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 6px;
}

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

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

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
