/* Korusu Besi — Premium Admin Panel */
:root {
    --p-primary: #0d4f1c;
    --p-primary-light: #1a7a32;
    --p-primary-soft: #e8f5e9;
    --p-accent: #c9a227;
    --p-accent-soft: #fff8e1;
    --p-surface: #f4f6f4;
    --p-surface-2: #ffffff;
    --p-surface-3: #eef1ee;
    --p-border: #dde3dd;
    --p-text: #141814;
    --p-text-muted: #5c665c;
    --p-danger: #c62828;
    --p-success: #2e7d32;
    --p-warning: #ef6c00;
    --p-radius: 14px;
    --p-radius-sm: 10px;
    --p-shadow: 0 1px 3px rgba(13, 79, 28, .06), 0 4px 12px rgba(13, 79, 28, .04);
    --p-shadow-lg: 0 12px 40px rgba(13, 79, 28, .12);
    --sidebar-w: 272px;
    --font: 'Plus Jakarta Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body.panel-app {
    margin: 0;
    font-family: var(--font);
    background: var(--p-surface);
    color: var(--p-text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Shell */
.panel-shell { display: flex; min-height: 100vh; }

.panel-sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0a3d15 0%, var(--p-primary) 45%, #145a28 100%);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 200;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, .15);
}

.panel-brand {
    padding: 1.35rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .65rem;
    letter-spacing: -.02em;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.panel-brand .material-symbols-outlined {
    font-size: 28px;
    background: rgba(255, 255, 255, .15);
    padding: 6px;
    border-radius: 12px;
}

.panel-nav {
    padding: 1rem .75rem;
    flex: 1;
    overflow-y: auto;
}

.panel-nav-section {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, .45);
    padding: .75rem 1rem .35rem;
    margin-top: .5rem;
}

.panel-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .72rem 1rem;
    margin: 2px 0;
    border-radius: 12px;
    color: rgba(255, 255, 255, .82);
    text-decoration: none;
    font-weight: 500;
    font-size: .9rem;
    transition: background .2s, transform .15s;
}

.panel-nav a:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    transform: translateX(2px);
}

.panel-nav a.active {
    background: rgba(255, 255, 255, .18);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--p-accent);
}

.panel-nav a.panel-nav-external { opacity: .9; }
.panel-nav .material-symbols-outlined { font-size: 22px; opacity: .95; }

.panel-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.panel-topbar {
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--p-border);
    padding: .85rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.panel-topbar h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.panel-topbar-search {
    flex: 1;
    max-width: 320px;
    position: relative;
}

.panel-topbar-search .material-symbols-outlined {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--p-text-muted);
    pointer-events: none;
}

.panel-topbar-search input {
    width: 100%;
    padding: .6rem 1rem .6rem 2.75rem;
    border: 1px solid var(--p-border);
    border-radius: 999px;
    background: var(--p-surface);
    font-family: inherit;
    font-size: .875rem;
    transition: border-color .2s, box-shadow .2s;
}

.panel-topbar-search input:focus {
    outline: none;
    border-color: var(--p-primary-light);
    box-shadow: 0 0 0 3px rgba(26, 122, 50, .15);
    background: #fff;
}

.panel-content { padding: 1.5rem 1.75rem 2.5rem; flex: 1; }

/* Page header */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.03em;
}

.page-header .subtitle {
    color: var(--p-text-muted);
    font-size: .875rem;
    margin: .25rem 0 0;
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .8125rem;
    color: var(--p-text-muted);
    margin-bottom: .5rem;
}

.page-breadcrumb a { color: var(--p-primary-light); text-decoration: none; }
.page-breadcrumb a:hover { text-decoration: underline; }

/* KPI cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--p-surface-2);
    border-radius: var(--p-radius);
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--p-border);
    box-shadow: var(--p-shadow);
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}

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

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--kpi-accent, var(--p-primary-light));
}

.kpi-card.kpi-primary { --kpi-accent: var(--p-primary-light); }
.kpi-card.kpi-gold { --kpi-accent: var(--p-accent); }
.kpi-card.kpi-success { --kpi-accent: var(--p-success); }
.kpi-card.kpi-warning { --kpi-accent: var(--p-warning); }
.kpi-card.kpi-muted { --kpi-accent: #90a4ae; }

.kpi-card .kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--p-primary-soft);
    color: var(--p-primary);
    margin-bottom: .75rem;
}

.kpi-card.kpi-gold .kpi-icon { background: var(--p-accent-soft); color: #8d6e00; }

.kpi-card .kpi-value {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.1;
}

.kpi-card .kpi-label {
    font-size: .8125rem;
    color: var(--p-text-muted);
    margin-top: .2rem;
}

.kpi-card .kpi-trend {
    font-size: .75rem;
    margin-top: .5rem;
    font-weight: 600;
}

.kpi-trend.up { color: var(--p-success); }
.kpi-trend.down { color: var(--p-danger); }

/* Progress */
.collection-progress {
    background: var(--p-surface-2);
    border-radius: var(--p-radius);
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--p-border);
    margin-bottom: 1.5rem;
}

.collection-progress .bar-wrap {
    height: 10px;
    background: var(--p-surface-3);
    border-radius: 999px;
    overflow: hidden;
    margin: .75rem 0;
}

.collection-progress .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--p-primary), var(--p-primary-light));
    border-radius: 999px;
    transition: width .6s ease;
}

/* Filter toolbar */
.filter-toolbar {
    background: var(--p-surface-2);
    border: 1px solid var(--p-border);
    border-radius: var(--p-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--p-shadow);
}

.filter-toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1rem;
    align-items: flex-end;
}

.filter-field {
    flex: 0 1 auto;
    min-width: 140px;
}

.filter-field.grow { flex: 1 1 200px; max-width: 320px; }

.filter-field label {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--p-text-muted);
    margin-bottom: .4rem;
}

.filter-field label .material-symbols-outlined { font-size: 16px; }

/* Forms */
.md-field { margin-bottom: 1rem; }

.md-field label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    color: var(--p-text-muted);
    margin-bottom: .35rem;
}

.md-input, .md-select, .md-textarea {
    width: 100%;
    padding: .7rem 1rem;
    border: 1px solid var(--p-border);
    border-radius: var(--p-radius-sm);
    background: var(--p-surface-2);
    font-size: .9rem;
    font-family: inherit;
    color: var(--p-text);
    transition: border-color .2s, box-shadow .2s;
}

.md-input:hover, .md-select:hover { border-color: #b8c4b8; }

.md-input:focus, .md-select:focus, .md-textarea:focus {
    outline: none;
    border-color: var(--p-primary-light);
    box-shadow: 0 0 0 3px rgba(26, 122, 50, .12);
}

.md-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235c665c'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 2.25rem;
    cursor: pointer;
}

.search-field-wrap { position: relative; }

.search-field-wrap .material-symbols-outlined {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--p-text-muted);
    pointer-events: none;
}

.search-field-wrap .md-input { padding-left: 2.75rem; }

/* Choices.js overrides */
.choices { margin-bottom: 0; font-family: var(--font); }
.choices__inner {
    min-height: 42px;
    padding: .35rem .5rem;
    border: 1px solid var(--p-border);
    border-radius: var(--p-radius-sm);
    background: var(--p-surface-2);
}
.choices.is-focused .choices__inner {
    border-color: var(--p-primary-light);
    box-shadow: 0 0 0 3px rgba(26, 122, 50, .12);
}
.choices__list--dropdown {
    border: 1px solid var(--p-border);
    border-radius: var(--p-radius-sm);
    box-shadow: var(--p-shadow-lg);
    z-index: 300;
}

/* Cards */
.md-card {
    background: var(--p-surface-2);
    border-radius: var(--p-radius);
    box-shadow: var(--p-shadow);
    border: 1px solid var(--p-border);
    overflow: hidden;
}

.md-card-header {
    padding: 1rem 1.35rem;
    border-bottom: 1px solid var(--p-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: linear-gradient(180deg, #fafcfa 0%, #fff 100%);
}

.md-card-header h2, .md-card-header h3 {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
}

.md-card-body { padding: 1.35rem; }

.chart-wrap { position: relative; height: 260px; padding: .5rem; }
.chart-wrap.chart-sm { height: 200px; }

/* Buttons */
.md-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.15rem;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    font-size: .8125rem;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
    font-family: inherit;
    white-space: nowrap;
}

.md-btn-filled {
    background: linear-gradient(135deg, var(--p-primary) 0%, var(--p-primary-light) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(13, 79, 28, .25);
}

.md-btn-filled:hover {
    color: #fff;
    box-shadow: 0 4px 14px rgba(13, 79, 28, .35);
    transform: translateY(-1px);
}

.md-btn-tonal {
    background: var(--p-primary-soft);
    color: var(--p-primary);
}

.md-btn-tonal:hover { background: #d4edd6; color: var(--p-primary); }

.md-btn-outlined {
    background: transparent;
    border: 1.5px solid var(--p-border);
    color: var(--p-primary);
}

.md-btn-outlined:hover {
    border-color: var(--p-primary-light);
    background: var(--p-primary-soft);
}

.md-btn-text {
    background: transparent;
    color: var(--p-primary-light);
}

.md-btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
}

.md-btn-sm { padding: .4rem .85rem; font-size: .75rem; }

.view-toggle {
    display: inline-flex;
    background: var(--p-surface-3);
    border-radius: 999px;
    padding: 3px;
    border: 1px solid var(--p-border);
}

.view-toggle button {
    border: none;
    background: transparent;
    padding: .4rem .75rem;
    border-radius: 999px;
    cursor: pointer;
    color: var(--p-text-muted);
    display: flex;
    align-items: center;
}

.view-toggle button.active {
    background: #fff;
    color: var(--p-primary);
    box-shadow: var(--p-shadow);
}

/* Table */
.md-table-wrap { overflow-x: auto; }

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

.md-table th {
    text-align: left;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--p-text-muted);
    padding: .85rem 1.15rem;
    background: var(--p-surface-3);
    border-bottom: 1px solid var(--p-border);
    white-space: nowrap;
}

.md-table td {
    padding: .9rem 1.15rem;
    border-bottom: 1px solid var(--p-border);
    vertical-align: middle;
}

.md-table tbody tr {
    transition: background .15s;
    cursor: default;
}

.md-table tbody tr.clickable-row { cursor: pointer; }
.md-table tbody tr.clickable-row:hover td { background: var(--p-primary-soft); }
.md-table tbody tr:last-child td { border-bottom: none; }

/* Kurban cards grid */
.kurban-grid .master-hero-chip {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .75rem 1rem;
    background: linear-gradient(135deg, rgba(255, 193, 7, .15), rgba(255, 193, 7, .05));
    border: 1px solid rgba(255, 193, 7, .35);
    border-radius: 12px;
}

.master-hero-chip .material-symbols-outlined {
    color: #b8860b;
    font-size: 28px;
}

.master-hero-chip .label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--md-muted, #6c757d);
    display: block;
}

.master-line .material-symbols-outlined {
    color: #b8860b;
}

.status-picker {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.status-picker-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: .5rem .75rem;
    border: 1px solid var(--md-outline, #dee2e6);
    border-radius: 8px;
    background: #fff;
    font-size: .875rem;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.status-picker-btn:hover {
    border-color: var(--md-primary, #1a7a32);
}

.status-picker-btn.active {
    border-color: var(--md-primary, #1a7a32);
    background: rgba(26, 122, 50, .1);
    font-weight: 600;
}

.kurban-card {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: transform .2s, box-shadow .2s;
}

.kurban-grid .kurban-card:hover {
    transform: translateY(-4px);
}

.kurban-grid .kurban-card .md-card {
    height: 100%;
    border-left: 4px solid var(--p-primary-light);
}

.kurban-grid .kurban-card .card-code {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .65rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    background: var(--p-primary-soft);
    color: var(--p-primary);
}

.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Chips */
.md-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .85rem;
    border-radius: 999px;
    background: var(--p-surface-3);
    font-size: .8125rem;
    font-weight: 500;
    border: 1px solid var(--p-border);
}

.md-chip.gold {
    background: var(--p-accent-soft);
    border-color: #e6d48a;
    color: #6d5a10;
}

/* Stats (legacy) */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-tile {
    background: var(--p-surface-2);
    border-radius: var(--p-radius-sm);
    padding: 1rem 1.15rem;
    border: 1px solid var(--p-border);
}

.stat-tile .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--p-primary);
}

.stat-tile .label {
    font-size: .8rem;
    color: var(--p-text-muted);
}

/* Snackbar */
.md-snackbar {
    padding: .9rem 1.25rem;
    border-radius: var(--p-radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 500;
    animation: slideIn .35s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.md-snackbar.success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #a5d6a7;
}

.md-snackbar.error {
    background: #ffebee;
    color: var(--p-danger);
    border: 1px solid #ef9a9a;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--p-text-muted);
}

.empty-state .material-symbols-outlined {
    font-size: 56px;
    opacity: .35;
    margin-bottom: .75rem;
}

/* Search dropdown */
.search-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--p-border);
    border-radius: var(--p-radius-sm);
    box-shadow: var(--p-shadow-lg);
    max-height: 280px;
    overflow-y: auto;
    z-index: 400;
    display: none;
}

.search-dropdown.show { display: block; }

.search-dropdown button {
    width: 100%;
    text-align: left;
    padding: .75rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: .875rem;
}

.search-dropdown button:hover { background: var(--p-primary-soft); }

/* Login */
body.panel-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a3d15 0%, #1a7a32 50%, #0d4f1c 100%);
    margin: 0;
    font-family: var(--font);
    padding: 1rem;
}

.login-shell {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--p-shadow-lg);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand .logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto .75rem;
    background: var(--p-primary-soft);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--p-primary);
}

.login-brand h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: var(--p-text);
}

/* Kurban detail */
.kurban-hero {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.kurban-hero img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--p-radius);
}

.panel-pane { display: none; }
.panel-pane.active { display: block; }

.md-segment {
    display: inline-flex;
    background: var(--p-surface-3);
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 1.25rem;
    border: 1px solid var(--p-border);
}

.md-segment button {
    border: none;
    background: transparent;
    padding: .5rem 1.15rem;
    border-radius: 999px;
    font-weight: 600;
    color: var(--p-text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: .8125rem;
}

.md-segment button.active {
    background: #fff;
    color: var(--p-primary);
    box-shadow: var(--p-shadow);
}

/* Kurban anlık durum — tek seçim */
.status-radio-list {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.status-radio-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .75rem;
    border: 1px solid var(--p-border);
    border-radius: var(--p-radius-sm);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin: 0;
    font-weight: 500;
}

.status-radio-item input {
    margin: 0;
    flex-shrink: 0;
}

.status-radio-item.is-active,
.status-radio-item:has(input:checked) {
    border-color: var(--p-primary);
    background: color-mix(in srgb, var(--p-primary) 8%, transparent);
}

.status-admin-form {
    padding-top: .25rem;
}

.hidden { display: none !important; }

.text-success { color: var(--p-success) !important; }

@media (max-width: 991px) {
    .panel-sidebar { transform: translateX(-100%); }
    .panel-sidebar.open { transform: translateX(0); }
    .panel-main { margin-left: 0; }
    .panel-topbar-search { display: none; }
    .kurban-hero { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .panel-content { padding: 1rem; }
}
