:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 56px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #3b82f6;
    --content-bg: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0; padding: 0;
    background: var(--content-bg);
    color: #334155;
    font-size: 14px;
    overflow-x: hidden;
    max-width: 100vw;
    -webkit-font-smoothing: antialiased;
}

#blazor-error-ui { display: none; }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; overflow-x: hidden; max-width: 100vw; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1a2744 100%);
    color: #94a3b8;
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 1000;
    transition: width 0.3s ease;
    overflow-x: hidden;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.sidebar.collapsed .brand-text, .sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-group-title span, .sidebar.collapsed .group-arrow,
.sidebar.collapsed .sidebar-footer { display: none; }

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 20px;
    font-size: 1.3rem; font-weight: 700; color: #ffffff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
}
.sidebar-brand i { font-size: 1.6rem; color: var(--sidebar-active); }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 16px; color: #94a3b8;
    text-decoration: none; border-radius: 10px;
    margin-bottom: 2px; transition: var(--transition);
    white-space: nowrap; font-size: 0.85rem;
    position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; transform: translateX(2px); }
.nav-item.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff; font-weight: 500;
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}
.nav-item i { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item.sub { padding-left: 48px; font-size: 0.8rem; }

.nav-group-title {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; color: #64748b;
    font-size: 0.78rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    cursor: pointer; white-space: nowrap;
    transition: var(--transition);
}
.nav-group-title:hover { color: #94a3b8; }
.nav-group-title i:first-child { font-size: 1.1rem; width: 20px; text-align: center; }
.group-arrow { margin-left: auto; font-size: 0.7rem; transition: transform 0.3s ease; }
.group-arrow.rotated { transform: rotate(180deg); }

.sidebar-footer {
    padding: 12px 20px; border-top: 1px solid rgba(255,255,255,0.08);
    color: #475569; font-size: 0.72rem; text-align: center;
}

/* ===== MAIN AREA ===== */
.main-area {
    flex: 1; margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh; display: flex; flex-direction: column;
    overflow-x: hidden; min-width: 0;
}
.sidebar.collapsed ~ .main-area { margin-left: var(--sidebar-collapsed-width); }

/* ===== HEADER ===== */
.top-header {
    height: var(--header-height);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.avatar-circle {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 600;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
    transition: var(--transition);
}
.avatar-circle:hover { transform: scale(1.1); }

/* ===== CONTENT ===== */
.content-area { flex: 1; padding: 24px; background: var(--content-bg); overflow-x: hidden; min-width: 0; }

/* ===== CARDS ===== */
.card {
    border: none; border-radius: 14px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    background: #ffffff;
}
.card:hover { box-shadow: var(--card-shadow-hover); }

.card-header {
    background: #ffffff; border-bottom: 1px solid #f1f5f9;
    font-weight: 600; border-radius: 14px 14px 0 0 !important;
}

.stat-card {
    border: none; border-radius: 14px;
    padding: 20px 24px; background: #ffffff;
    box-shadow: var(--card-shadow);
    display: flex; align-items: center; gap: 16px;
    transition: var(--transition);
    cursor: pointer;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--card-shadow-hover); }

.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.stat-value { font-size: 1.75rem; font-weight: 700; color: #0f172a; line-height: 1; }
.stat-label { font-size: 0.8rem; color: #64748b; margin-bottom: 4px; }

/* ===== TABLE ===== */
.table-card {
    background: #ffffff; border-radius: 14px;
    box-shadow: var(--card-shadow); overflow: hidden;
}
.table-card .table { margin-bottom: 0; font-size: 0.85rem; }

.table-card .table thead th {
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600; color: #475569;
    font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.5px; padding: 14px 16px;
    position: sticky; top: 0;
}

.table-card .table tbody td {
    padding: 12px 16px; vertical-align: middle;
    border-bottom: 1px solid #f8fafc; color: #334155;
    transition: background 0.15s;
}

/* Zebra efekti */
.table-card .table tbody tr:nth-child(even) { background: #fafbfc; }
.table-card .table tbody tr:hover { background: #eff6ff !important; }
.table-card .table tbody tr:last-child td { border-bottom: none; }

/* Tablo icindeki badge'ler */
.table-card .table .badge { font-size: 0.7rem; padding: 4px 8px; }

/* ===== OFFCANVAS ===== */
.offcanvas-end { width: 500px !important; border-left: 1px solid #e2e8f0; }
.offcanvas-header { background: #f8fafc; border-bottom: 1px solid #e2e8f0; padding: 16px 24px; }
.offcanvas-body { padding: 24px; }

/* ===== BUTTONS ===== */
.btn {
    border-radius: 10px; font-weight: 500;
    transition: var(--transition);
    position: relative; overflow: hidden;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none; padding: 8px 18px;
    box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 12px rgba(59,130,246,0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    box-shadow: 0 2px 8px rgba(34,197,94,0.25);
}
.btn-success:hover { box-shadow: 0 4px 12px rgba(34,197,94,0.35); }

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}

.btn-outline-primary { border-radius: 10px; font-weight: 500; padding: 8px 18px; }
.btn-outline-primary:hover { transform: translateY(-1px); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; border-radius: 8px; }
.btn-lg { padding: 12px 24px; font-size: 1rem; border-radius: 12px; }

/* ===== FORM ===== */
.form-control, .form-select {
    border-radius: 10px; border: 1.5px solid #e2e8f0;
    font-size: 0.875rem; padding: 10px 14px;
    transition: var(--transition);
    background: #ffffff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.1);
}
.form-control::placeholder { color: #94a3b8; }
.form-label { font-size: 0.8rem; font-weight: 600; color: #475569; margin-bottom: 6px; }

.input-group { max-width: 100%; }
.input-group .input-group-text {
    border-radius: 10px 0 0 10px; border: 1.5px solid #e2e8f0;
    border-right: none; background: #f8fafc; color: #64748b;
}
.input-group .form-control { border-radius: 0 10px 10px 0; border-left: none; }

/* ===== BADGES ===== */
.badge {
    font-weight: 500; font-size: 0.72rem;
    padding: 5px 10px; border-radius: 8px;
    letter-spacing: 0.2px;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h4 { font-weight: 700; color: #0f172a; margin: 0; letter-spacing: -0.3px; }

/* ===== MODAL ===== */
.modal-content {
    border: none; border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.15);
    overflow: hidden;
}
.modal-header { border-bottom: 1px solid #f1f5f9; padding: 18px 24px; }
.modal-footer { border-top: 1px solid #f1f5f9; padding: 16px 24px; }
.modal-body { padding: 24px; }
.modal-dialog { margin: 8px; }
.modal-lg { max-width: calc(100vw - 16px); }

/* ===== LIST GROUP ===== */
.list-group-item {
    border: none; border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;
}
.list-group-item:hover { background: #f8fafc; }
.list-group-item.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    border-color: transparent;
}

/* ===== QUICK ACCESS ===== */
.quick-card {
    background: #ffffff; border-radius: 14px;
    padding: 16px; box-shadow: var(--card-shadow);
    text-align: center; cursor: pointer;
    transition: var(--transition);
    text-decoration: none; color: inherit; display: block;
}
.quick-card:hover { transform: translateY(-4px); box-shadow: var(--card-shadow-hover); color: var(--sidebar-active); }
.quick-card i { font-size: 1.5rem; margin-bottom: 8px; display: block; }
.quick-card span { font-size: 0.82rem; font-weight: 500; }

/* ===== PATIENT ROW ===== */
.patient-row {
    padding: 10px 12px; border-radius: 10px;
    cursor: pointer; transition: var(--transition);
    border-left: 3px solid transparent;
}
.patient-row:hover { background: #f1f5f9; }
.patient-row.active { background: #eff6ff; border-left-color: var(--sidebar-active); }

/* ===== PROGRESS ===== */
.progress { border-radius: 10px; height: 8px; background: #f1f5f9; }
.progress-bar { border-radius: 10px; transition: width 0.6s ease; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.fade-in { animation: fadeIn 0.3s ease; }
.slide-in { animation: slideIn 0.3s ease; }

/* Skeleton loading */
.skeleton { background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* Spinner */
.spinner-border { width: 1.5rem; height: 1.5rem; border-width: 2px; }

/* ===== ALERT ===== */
.alert { border: none; border-radius: 12px; font-size: 0.85rem; }
.alert-success { background: #f0fdf4; color: #166534; border-left: 4px solid #22c55e; }
.alert-danger { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-info { background: #eff6ff; color: #1e40af; border-left: 4px solid #3b82f6; }

/* ===== TABLE RESPONSIVE ===== */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.row { margin-left: 0; margin-right: 0; }
.row > * { max-width: 100%; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); z-index: 2000; }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar.collapsed { transform: translateX(-100%); }
    .main-area { margin-left: 0 !important; }
    .offcanvas-end { width: 100% !important; }
    .mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1999; }
    .content-area { padding: 10px; }

    .page-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
    .page-header h4 { font-size: 1.1rem; }
    .page-header .btn { width: 100%; font-size: 0.85rem; }
    .page-header .btn-group { width: 100%; }
    .page-header .btn-group .btn { flex: 1; font-size: 0.75rem; padding: 6px 4px; }

    .stat-card { padding: 12px; gap: 10px; }
    .stat-icon { width: 36px; height: 36px; font-size: 1rem; border-radius: 8px; }
    .stat-value { font-size: 1.2rem; }
    .stat-label { font-size: 0.7rem; }

    .table-card { border-radius: 10px; }
    .table-card .table thead th { font-size: 0.68rem; padding: 8px 6px; white-space: nowrap; }
    .table-card .table tbody td { font-size: 0.78rem; padding: 8px 6px; }

    .top-header { padding: 0 10px; }
    .top-header .badge { display: none; }
    .top-header .dropdown-toggle span { display: none; }

    .login-card { width: 95%; padding: 24px 20px; }

    .card { border-radius: 10px; }
    .card-body { padding: 12px; }
    .card-header { padding: 10px 12px; font-size: 0.85rem; }

    .btn-group-sm .btn { font-size: 0.75rem; padding: 4px 8px; }

    .form-control, .form-select { font-size: 16px; padding: 10px 12px; }
    .form-control-lg { font-size: 16px; }
    .form-label { font-size: 0.75rem; }

    .badge { font-size: 0.65rem; padding: 3px 7px; }
    .fs-4 { font-size: 1.1rem !important; }
    .fs-3 { font-size: 1.2rem !important; }

    .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8 { padding-left: 0; padding-right: 0; }

    .modal-dialog { margin: 4px; }
    .modal-content { border-radius: 14px; }
    .modal-lg { max-width: 100%; }
    .modal-body { padding: 16px; }
    .modal-header { padding: 12px 16px; }
    .modal-footer { padding: 12px 16px; }
    .modal-body .row .col-4, .modal-body .row .col-6, .modal-body .row .col-8 { flex: 0 0 100%; max-width: 100%; }

    .list-group-item { padding: 8px 12px; font-size: 0.85rem; }
}

@media (max-width: 400px) {
    .content-area { padding: 6px; }
    .page-header h4 { font-size: 1rem; }
    .card-body { padding: 10px; }
    .fs-4 { font-size: 1rem !important; }
    .fs-5 { font-size: 0.95rem !important; }
}

/* ===== LOGIN ===== */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #3b82f6 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: white; border-radius: 20px;
    padding: 48px 40px; width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    animation: fadeIn 0.5s ease;
}

/* ===== SELECTION HIGHLIGHT ===== */
::selection { background: rgba(59,130,246,0.2); }

/* ===== CODE ===== */
code {
    background: #f1f5f9; color: #6366f1;
    padding: 2px 6px; border-radius: 4px;
    font-size: 0.82rem; font-weight: 500;
}
