@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Sora:wght@300;400;500;600;700&display=swap');

/* ── Design Tokens ── */
:root {
    --brand-red-800: #7a122a;
    --brand-red-700: #b91c2f;
    --brand-red-600: #dc2626;
    --brand-red-500: #ef4444;
    --brand-red-400: #f87171;
    --brand-rose-50:  #fff1f2;
    --brand-rose-100: #ffe4e6;
    --brand-rose-200: #fecdd3;
    --ink-900: #1f0a0f;
    --ink-700: #4a0d1c;
    --ink-500: #7a122a;
    --app-gradient: linear-gradient(145deg, #fff1f2 0%, #fde8ec 40%, #f9cfd6 80%, #f0b3be 100%);
    --drawer-gradient: linear-gradient(175deg, #1a0609 0%, #2b0b12 30%, #4a0d1c 65%, #6b1225 100%);
    --surface-glass: rgba(255, 255, 255, 0.92);
    --surface-card: rgba(255, 255, 255, 0.82);
    --shadow-strong: 0 24px 64px rgba(20, 3, 8, 0.22), 0 8px 20px rgba(20, 3, 8, 0.12);
    --shadow-soft: 0 8px 28px rgba(140, 18, 40, 0.14);
    --shadow-card: 0 4px 16px rgba(20, 3, 8, 0.08);
    --focus-ring: 0 0 0 4px rgba(239, 68, 68, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
}

/* ── Base ── */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    font-family: 'Sora', system-ui, sans-serif;
    min-height: 100%;
}

body {
    background: var(--app-gradient);
    background-attachment: fixed;
    color: var(--ink-900);
    line-height: 1.6;
}

/* ── Links ── */
a, .btn-link {
    color: var(--brand-red-700);
    transition: color 0.2s ease;
}

a:hover, .btn-link:hover {
    color: var(--brand-red-600);
}

/* ── Buttons ── */
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-red-600), var(--brand-red-700));
    border-color: var(--brand-red-700);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-red-500), var(--brand-red-600));
    border-color: var(--brand-red-600);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(185, 28, 47, 0.3);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: var(--focus-ring);
    outline: none;
}

/* ── Content padding ── */
.content {
    padding-top: 1.25rem;
    padding-bottom: 1.5rem;
}

/* ── Typography ── */
h1:focus { outline: none; }

h1, h2, h3, h4, h5 {
    font-weight: 700;
    color: var(--ink-900);
}

/* ── Forms ── */
.form-control,
.form-select {
    border-radius: var(--radius-md);
    border: 1.5px solid #f0b7bf;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-red-500);
    box-shadow: var(--focus-ring);
}

/* ── Validation ── */
.valid.modified:not([type=checkbox]) {
    outline: 1.5px solid #16a34a;
    border-radius: var(--radius-md);
}

.invalid {
    outline: 1.5px solid var(--brand-red-600);
    border-radius: var(--radius-md);
}

.validation-message {
    color: var(--brand-red-600);
    font-size: 0.82rem;
    margin-top: 0.2rem;
}

/* ── Blazor error ── */
.blazor-error-boundary {
    background: #fef2f2 url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMj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TUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZSIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem;
    padding: 1rem 1rem 1rem 3.7rem;
    color: #991b1b;
    border-radius: var(--radius-md);
    border: 1px solid #fca5a5;
}

.blazor-error-boundary::after {
    content: "Bir hata oluştu."
}

/* ── Utilities ── */
.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(185, 28, 47, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(185, 28, 47, 0.35); }

/* ── Data Pages ── */
.data-page {
    padding: 1.5rem 0 2rem;
    animation: dataPageFade 0.5s ease both;
}

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

.data-page-header {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-bottom: 1.5rem;
    padding: 1.1rem 1.5rem;
    background: rgba(255, 255, 255, 0.78);
    border-radius: 16px;
    border: 1px solid rgba(185, 28, 47, 0.1);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(20, 3, 8, 0.06);
}

.data-page-icon-wrap {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #b91c2f, #dc2626);
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(185, 28, 47, 0.3);
}

.data-page-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: #1f0a0f;
    margin: 0;
}

/* ── Modern DataGrid card ── */
.data-grid-card {
    background: rgba(255, 255, 255, 0.88);
    border-radius: 16px;
    border: 1px solid rgba(185, 28, 47, 0.09);
    box-shadow: 0 4px 28px rgba(20, 3, 8, 0.09);
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.data-grid-card .table.modern-table {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

/* Column header row */
.data-grid-card .table.modern-table thead tr:first-child th {
    background: linear-gradient(135deg, #8b1a2e 0%, #b91c2f 100%);
    color: rgba(255, 255, 255, 0.97);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.9rem 1rem;
    border: none;
    white-space: nowrap;
    vertical-align: middle;
    min-width: 100px;
}

/* Filter row */
.data-grid-card .table.modern-table thead tr:nth-child(n+2) th {
    background: rgba(255, 245, 246, 0.9);
    border-bottom: 2px solid rgba(185, 28, 47, 0.1);
    padding: 0.45rem 0.75rem;
    vertical-align: middle;
    min-width: 100px;
}

.data-grid-card .table.modern-table thead tr:nth-child(n+2) th .form-control,
.data-grid-card .table.modern-table thead tr:nth-child(n+2) th .form-select {
    background: white;
    border: 1.5px solid rgba(185, 28, 47, 0.18);
    border-radius: 8px;
    font-size: 0.82rem;
    padding: 0.3rem 0.6rem;
    color: #1f0a0f;
    min-width: 80px;
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.data-grid-card .table.modern-table thead tr:nth-child(n+2) th .form-control:focus,
.data-grid-card .table.modern-table thead tr:nth-child(n+2) th .form-select:focus {
    border-color: #b91c2f;
    box-shadow: 0 0 0 3px rgba(185, 28, 47, 0.12);
    outline: none;
}

/* Body rows */
.data-grid-card .table.modern-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-grid-card .table.modern-table tbody tr:nth-child(even) {
    background-color: rgba(255, 241, 242, 0.45);
}

.data-grid-card .table.modern-table tbody tr:hover {
    background-color: rgba(185, 28, 47, 0.06) !important;
}

.data-grid-card .table.modern-table tbody tr td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid rgba(185, 28, 47, 0.05);
    border-top: none;
    font-size: 0.875rem;
    color: #1f0a0f;
    vertical-align: middle;
}

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

/* Pagination area */
.data-grid-card .pagination {
    margin: 0;
    gap: 2px;
}

.data-grid-card .pagination .page-link {
    color: #b91c2f;
    border-color: rgba(185, 28, 47, 0.2);
    border-radius: 8px !important;
    font-size: 0.82rem;
    padding: 0.35rem 0.65rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.data-grid-card .pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #b91c2f, #dc2626);
    border-color: #b91c2f;
    color: white;
    box-shadow: 0 2px 8px rgba(185, 28, 47, 0.35);
}

.data-grid-card .pagination .page-link:hover:not(.active) {
    background-color: rgba(185, 28, 47, 0.08);
    color: #b91c2f;
    border-color: rgba(185, 28, 47, 0.3);
}

.data-grid-card .pagination .page-item.disabled .page-link {
    color: rgba(107, 48, 64, 0.35);
    border-color: rgba(185, 28, 47, 0.1);
}

/* ── Layout: GDS Push-Sidebar Shell ── */
.gds-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.gds-sidebar {
    width: 260px;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--drawer-gradient);
    box-shadow: 2px 0 16px rgba(20,3,8,0.18);
    display: flex;
    flex-direction: column;
}

.gds-sidebar.collapsed { width: 0; }

.gds-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.gds-topbar {
    height: 60px;
    flex-shrink: 0;
    background: var(--drawer-gradient);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.75rem;
    box-shadow: 0 2px 12px rgba(20,3,8,0.25);
    position: relative;
}

.gds-hamburger {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
    color: white;
    font-size: 1.1rem;
    line-height: 1;
}

.gds-hamburger:hover { background: rgba(255,255,255,0.18); }

.gds-topbar-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Bebas Neue', 'Sora', sans-serif;
    font-size: 1.35rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.95) !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

.gds-topbar-end {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

.gds-topbar-end select,
.gds-topbar-end .form-select {
    background: rgba(255,255,255,0.12) !important;
    border: 1px solid rgba(255,255,255,0.22) !important;
    color: rgba(255,255,255,0.9) !important;
    border-radius: 8px !important;
    font-size: 0.82rem !important;
    height: 38px !important;
    padding: 0 0.55rem !important;
    cursor: pointer;
}

.gds-topbar-end select option,
.gds-topbar-end .form-select option {
    background: #2b0b12;
    color: white;
}

.gds-user-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 10px;
    padding: 0.3rem 0.7rem 0.3rem 0.35rem;
}

.gds-user-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #b91c2f, #dc2626);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white !important;
    flex-shrink: 0;
}

.gds-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255,255,255,0.88) !important;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gds-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

/* ── Sidebar backdrop overlay (mobile) ── */
.gds-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 2, 5, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1040;
    cursor: pointer;
}

.gds-overlay.active {
    display: block;
    animation: overlayFadeIn 0.22s ease both;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Mobile layout (< 768px): sidebar as overlay, content full-width ── */
@media (max-width: 767.98px) {
    /* Sidebar: lives outside flex flow, hidden off-screen left */
    .gds-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        height: 100dvh;
        width: 260px !important; /* always 260px; JS handles show/hide via transform */
        transform: translateX(-260px);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1050;
        box-shadow: 4px 0 32px rgba(10, 2, 5, 0.45);
        overflow-y: auto;
    }

    /* "collapsed" class has no effect on mobile — transform handles hide */
    .gds-sidebar.collapsed {
        transform: translateX(-260px);
    }

    /* Opened via hamburger */
    .gds-sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    /* Content area takes full viewport width */
    .gds-content-area {
        width: 100%;
        min-width: 0;
    }

    /* Topbar: hide title text on very small phones to prevent any squeeze */
    .gds-topbar-title {
        font-size: 1.1rem;
        letter-spacing: 0.14em;
    }

    /* User pill: truncate long usernames more aggressively */
    .gds-user-name {
        max-width: 80px;
    }
}

/* ── Very small phones (< 480px): shrink topbar title further ── */
@media (max-width: 479.98px) {
    .gds-topbar-title {
        font-size: 0.9rem;
        letter-spacing: 0.08em;
    }

    /* Shrink user name pill to icon-only on tiny screens */
    .gds-user-name {
        display: none;
    }
}

/* ── Tablet (768px – 991.98px): slightly tighter sidebar, no overlay ── */
@media (min-width: 768px) and (max-width: 991.98px) {
    .gds-sidebar {
        width: 220px;
    }

    /* Adjust logo image to fit narrower sidebar */
    .sidebar-logo img {
        width: 140px;
    }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Data Page Topbar (Mekik Selector) ── */
.dp-topbar {
    background: linear-gradient(135deg, rgba(255,255,255,0.97) 0%, rgba(255,245,246,0.97) 100%);
    border-radius: 16px;
    border: 1px solid rgba(185,28,47,0.12);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: stretch;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 18px rgba(20,3,8,0.08), 0 1px 4px rgba(185,28,47,0.06);
    overflow: hidden;
}

.dp-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.4rem;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.dp-topbar-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #b91c2f, #dc2626);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(185,28,47,0.3);
}

.dp-topbar-lbl {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7a122a;
    margin-bottom: 0.2rem;
}

.dp-select {
    min-width: 220px;
    max-width: 360px;
    border-radius: 8px !important;
    font-size: 0.92rem;
    font-weight: 600;
    border: 1.5px solid rgba(185,28,47,0.18) !important;
    background: white !important;
    color: #1f0a0f;
}

/* Empty state for data grid */
.dp-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1rem;
    color: #9ca3af;
    gap: 0.5rem;
}

.dp-empty-icon {
    font-size: 2.8rem;
    opacity: 0.45;
}

/* ── Responsive ── */
@media (max-width: 576px) {
    .dp-topbar-left {
        gap: 0.6rem;
        padding: 0.75rem 1rem;
    }

    .dp-select {
        min-width: 100%;
        max-width: 100%;
    }
}
