/* ═══════════════════════════════════════════════════════════════
   Mój Śmietnik – Admin Panel  |  Premium Dark Theme
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS Variables ──────────────────────────────────────────── */
:root {
    --bg-primary: #0f1117;
    --bg-sidebar: #161b22;
    --bg-card: #1c2128;
    --bg-input: #21262d;
    --bg-hover: #262c36;
    --bg-topbar: #161b22;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    --accent: #10b981;
    --accent-hover: #34d399;
    --accent-glow: rgba(16, 185, 129, 0.15);
    --accent-subtle: rgba(16, 185, 129, 0.08);

    --border-color: #30363d;
    --border-subtle: #21262d;

    --danger: #f85149;
    --danger-hover: #ff6b63;
    --warning: #d29922;
    --info: #58a6ff;
    --purple: #bc8cff;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.1);

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ─── Loading Screen ─────────────────────────────────────────── */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

/* ─── Sidebar ────────────────────────────────────────────────── */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-slow);
}

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

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: block;
    flex-shrink: 0;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-text h1 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.sidebar-brand-text span {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.sidebar-nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 1rem 0.75rem 0.5rem;
    margin: 0;
}

.sidebar-nav a,
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 450;
    transition: all var(--transition-fast);
    position: relative;
}

.sidebar-nav a:hover,
.sidebar-nav .nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav a.active,
.sidebar-nav .nav-link.active {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 500;
}

.sidebar-nav a.active::before,
.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-section {
    display: flex;
    flex-direction: column;
}

.nav-section-toggle {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 450;
    text-align: left;
    cursor: pointer;
    position: relative;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-section-toggle:hover,
.nav-section-toggle:focus-visible {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-section-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.nav-section-toggle.active {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 500;
}

.nav-section-toggle.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 60%;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
    transform: translateY(-50%);
}

.nav-section-label {
    min-width: 0;
    flex: 1;
    line-height: 1.25;
}

.nav-section-indicator {
    width: 20px;
    flex: 0 0 20px;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    text-align: center;
}

.nav-submenu {
    margin: 0.2rem 0 0.35rem 1.5rem;
    padding-left: 0.65rem;
    border-left: 1px solid var(--border-subtle);
}

.sidebar-nav .nav-submenu .nav-submenu-link {
    min-height: 36px;
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
}

.sidebar-city-filter {
    padding: 0.5rem 0.75rem 0.85rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-city-filter label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-city-filter .form-control {
    min-height: 36px;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    font-size: 0.8rem;
}

/* ─── Main Content Area ──────────────────────────────────────── */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ─── Top Bar ────────────────────────────────────────────────── */
.admin-topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
    gap: 1rem;
}

.environment-badge {
    margin-right: auto;
    padding: 0.3rem 0.55rem;
    border: 1px solid #facc15;
    border-radius: 4px;
    background: #422006;
    color: #fef08a;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.environment-badge.production {
    border-color: var(--accent);
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent);
}

.database-environment-panel {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.database-environment-panel.test {
    border-left-color: #facc15;
    background: rgba(66, 32, 6, 0.35);
}

.database-environment-panel > div {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.database-environment-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 650;
    text-transform: uppercase;
}

.database-environment-panel code {
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-user-email {
    font-size: 0.825rem;
    color: var(--text-secondary);
    font-weight: 450;
}

.topbar-user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

/* ─── Content ────────────────────────────────────────────────── */
.admin-content {
    flex: 1;
    padding: 2rem;
}

/* ─── Page Header ────────────────────────────────────────────── */
.page-header {
    margin-bottom: 2rem;
}

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

.page-header p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.875rem;
}

/* ─── Cards ──────────────────────────────────────────────────── */
.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition-base);
}

.admin-card:hover {
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-md);
}

/* Dashboard stat cards */
.quick-actions-section {
    margin-bottom: 1.5rem;
}

.quick-actions-section h3 {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 0.75rem;
}

.quick-action-link {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.quick-action-link:hover,
.quick-action-link:focus-visible {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
}

.quick-action-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.quick-action-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--accent-subtle);
    color: var(--accent);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0;
    transition: opacity var(--transition-base);
}

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

.stat-card:hover::after {
    opacity: 1;
}

.stat-card.emerald::after { background: linear-gradient(90deg, var(--accent), #34d399); }
.stat-card.blue::after    { background: linear-gradient(90deg, var(--info), #79b8ff); }
.stat-card.purple::after  { background: linear-gradient(90deg, var(--purple), #d2a8ff); }
.stat-card.amber::after   { background: linear-gradient(90deg, var(--warning), #e3b341); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.emerald { background: rgba(16, 185, 129, 0.12); color: var(--accent); }
.stat-icon.blue    { background: rgba(88, 166, 255, 0.12); color: var(--info); }
.stat-icon.purple  { background: rgba(188, 140, 255, 0.12); color: var(--purple); }
.stat-icon.amber   { background: rgba(210, 153, 34, 0.12); color: var(--warning); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-info .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-info .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 450;
}

/* ─── Tables ─────────────────────────────────────────────────── */
.admin-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.admin-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.admin-table-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.admin-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

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

.admin-table thead {
    background: var(--bg-input);
}

.admin-table th {
    padding: 0.75rem 1.25rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.75rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.table-sort-button:hover {
    color: var(--text-primary);
}

.table-sort-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.table-sort-button span {
    display: inline-block;
    min-width: 0.75rem;
    color: var(--accent);
}

.admin-table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.875rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: background var(--transition-fast);
}

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

.admin-table tbody tr.selected-row {
    background: rgba(16, 185, 129, 0.09);
    box-shadow: inset 3px 0 0 var(--accent);
}

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

/* ─── Buttons ────────────────────────────────────────────────── */
.btn-admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    font-size: 0.825rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn-admin:active {
    transform: scale(0.97);
}

.btn-admin:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: rgba(248, 81, 73, 0.3);
}

.btn-danger:hover {
    background: rgba(248, 81, 73, 0.1);
    border-color: var(--danger);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    padding: 0.4rem 0.65rem;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.775rem;
}

.btn-signout {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 450;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-signout:hover {
    background: rgba(248, 81, 73, 0.08);
    color: var(--danger);
    border-color: rgba(248, 81, 73, 0.3);
}

/* ─── Forms ──────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition-fast);
    outline: none;
}

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

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

.form-control:disabled,
.form-control[readonly] {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color);
    opacity: 1;
    -webkit-text-fill-color: var(--text-primary);
}

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

.readonly-field {
    display: flex;
    align-items: center;
    color: var(--text-primary);
    background: var(--bg-input);
    cursor: default;
}

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='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6.5 6.5 6.5-6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

/* ─── Form Card / Modal ──────────────────────────────────────── */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.form-card-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

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

.assignment-fractions {
    grid-column: 1 / -1;
}

.assignment-fraction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.5rem;
}

.assignment-fraction-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 42px;
    padding: 0.65rem 0.75rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.assignment-fraction-option:hover {
    border-color: var(--accent);
}

.assignment-fraction-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.assignment-fraction-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.experimental-subsection,
.experimental-preview,
.experimental-selection-panel {
    margin-top: 1.25rem;
}

.experimental-subsection {
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.experimental-counter {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.experimental-preview {
    max-height: 32rem;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.experimental-preview .admin-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.experimental-selection-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

.experimental-selection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.experimental-selection-header > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.experimental-selection-header span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.experimental-address-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.35rem;
    max-height: 22rem;
    padding: 0.75rem;
    overflow: auto;
}

.experimental-address-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 2.75rem;
    padding: 0.55rem 0.65rem;
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.experimental-address-option:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.experimental-address-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.mobile-preview {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.mobile-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mobile-schedule-card,
.mobile-segregation-card {
    width: min(100%, 520px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.mobile-schedule-card {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 1rem;
    align-items: center;
}

.mobile-schedule-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 74px;
    border-radius: var(--radius-md);
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.2);
}

.mobile-schedule-day {
    font-size: 1.7rem;
    line-height: 1;
    font-weight: 700;
    color: var(--text-primary);
}

.mobile-schedule-month {
    margin-top: 0.3rem;
    font-size: 0.68rem;
    text-align: center;
    color: var(--text-muted);
}

.mobile-schedule-content,
.mobile-segregation-content {
    min-width: 0;
}

.mobile-schedule-region,
.mobile-segregation-name {
    margin-bottom: 0.35rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
}

.mobile-schedule-description,
.mobile-segregation-hint {
    margin-top: 0.45rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.mobile-announcement-preview {
    width: min(100%, 420px);
}

.mobile-announcement-preview .mobile-preview-header {
    width: 100%;
}

.mobile-announcement-card {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.95rem 1rem;
}

.mobile-announcement-title {
    margin-bottom: 0.4rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.mobile-announcement-content {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.mobile-segregation-card {
    display: grid;
    grid-template-columns: 8px 1fr;
    gap: 0.85rem;
}

.mobile-segregation-strip {
    min-height: 82px;
    border-radius: 999px;
}

.mobile-segregation-category {
    font-size: 0.82rem;
    font-weight: 700;
}

/* ─── Status Badges ──────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-emerald {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent);
}

.badge-blue {
    background: rgba(88, 166, 255, 0.12);
    color: var(--info);
}

.badge-purple {
    background: rgba(188, 140, 255, 0.12);
    color: var(--purple);
}

.badge-amber {
    background: rgba(210, 153, 34, 0.12);
    color: var(--warning);
}

.badge-danger {
    background: rgba(248, 81, 73, 0.12);
    color: var(--danger);
}

/* ─── Login Page ─────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 1rem;
    position: relative;
    overflow-x: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    position: relative;
    z-index: 1;
}

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

.login-environment {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    margin: -0.75rem 0 1.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
}

.login-environment .environment-badge {
    margin-right: 0;
}

.login-environment.test {
    border-color: rgba(250, 204, 21, 0.55);
    background: rgba(66, 32, 6, 0.35);
}

.environment-project {
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.72rem;
    overflow-wrap: anywhere;
    text-align: center;
}

@media (max-width: 640px) {
    .database-environment-panel {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }
}

.login-brand-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: inline-block;
    margin-bottom: 1rem;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}

.login-brand h1,
.login-brand h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    letter-spacing: 0;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.login-error {
    background: rgba(248, 81, 73, 0.08);
    border: 1px solid rgba(248, 81, 73, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    margin-bottom: 1.25rem;
    color: var(--danger);
    font-size: 0.825rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.login-success {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    margin-bottom: 1.25rem;
    color: var(--accent);
    font-size: 0.825rem;
    line-height: 1.5;
}

.login-help {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0 0 1.25rem;
}

.login-link-row {
    margin-top: 1.25rem;
    text-align: center;
}

.login-link {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.login-link:hover {
    text-decoration: underline;
}

.login-link:focus-visible,
.login-btn:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.login-btn {
    width: 100%;
    padding: 0.7rem;
    background: linear-gradient(135deg, var(--accent), #059669);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 0.5rem;
}

.login-btn:hover {
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-btn-link {
    align-items: center;
    display: flex;
    justify-content: center;
    text-decoration: none;
}

/* ─── Alerts / Empty States ──────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

.alert-admin {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--accent);
}

.alert-error {
    background: rgba(248, 81, 73, 0.08);
    border: 1px solid rgba(248, 81, 73, 0.25);
    color: var(--danger);
}

.alert-warning {
    background: rgba(250, 204, 21, 0.08);
    border: 1px solid rgba(250, 204, 21, 0.28);
    color: #f5d765;
}

/* ─── Action Buttons in Tables ───────────────────────────────── */
.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

@media (max-width: 720px) {
    .admin-table-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─── Blazor Error UI ────────────────────────────────────────── */
#blazor-error-ui {
    background: var(--danger);
    color: #fff;
    padding: 0.6rem 1.2rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    text-align: center;
    font-size: 0.85rem;
    display: none;
}

#blazor-error-ui .reload {
    color: #fff;
    text-decoration: underline;
    margin-left: 0.5rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 1rem;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .admin-main {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .admin-content {
        padding: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-table-wrapper {
        overflow-x: auto;
    }

    .admin-topbar {
        padding: 0 1rem;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 1.75rem;
    }
}

/* ─── Overlay for mobile sidebar ─────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

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

/* ─── Misc Utilities ─────────────────────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }
.text-danger { color: var(--danger) !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}

.schedule-filter-bar {
    display: grid;
    grid-template-columns: minmax(160px, 0.7fr) repeat(3, minmax(180px, 1fr));
    gap: 1rem;
    align-items: end;
}

.schedule-month-label {
    min-height: 39px;
    display: flex;
    align-items: center;
    padding: 0.6rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 600;
    text-transform: capitalize;
}

.schedule-view-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.schedule-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: 0;
    min-width: 840px;
}

.schedule-calendar-weekday {
    padding: 0.7rem;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.schedule-calendar-day {
    min-height: 128px;
    padding: 0.65rem;
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.schedule-calendar-day:nth-child(7n + 7) {
    border-right: none;
}

.schedule-calendar-day.muted {
    opacity: 0.45;
}

.schedule-calendar-day.today {
    background: rgba(88, 166, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.25);
}

.schedule-calendar-date {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.45rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
}

.schedule-calendar-day.today .schedule-calendar-date {
    background: var(--info);
    color: #fff;
}

.schedule-calendar-items {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.schedule-calendar-item {
    width: 100%;
    min-height: 24px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.4rem;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schedule-calendar-more {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.waste-metals { background: #d29922; }
.waste-paper { background: #1f6feb; }
.waste-glass { background: #238636; }
.waste-bio { background: #8957e5; }
.waste-mixed { background: #da3633; }
.waste-bulky { background: #6e7681; }
.waste-default { background: var(--info); }

@media (max-width: 900px) {
    .schedule-filter-bar {
        grid-template-columns: 1fr 1fr;
    }

    .schedule-calendar {
        min-width: 760px;
        grid-template-columns: repeat(7, minmax(108px, 1fr));
    }
}

@media (max-width: 520px) {
    .schedule-filter-bar {
        grid-template-columns: 1fr;
    }

    .schedule-view-toggle {
        flex-wrap: wrap;
    }
}
.experimental-pgk-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.experimental-date-list {
    min-height: 150px;
    resize: vertical;
}

.form-group-wide {
    grid-column: span 2;
}

.experimental-analysis-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 48px;
    color: var(--text-secondary);
}

.experimental-analysis-progress .loading-spinner {
    width: 22px;
    height: 22px;
    border-width: 2px;
}

.experimental-analysis-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-top: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--border-color);
}

.experimental-analysis-summary > div {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    padding: 0.85rem 1rem;
    background: var(--bg-input);
}

.experimental-analysis-summary strong {
    color: var(--text-primary);
    font-size: 1.15rem;
}

.experimental-analysis-summary span {
    color: var(--text-muted);
    font-size: 0.78rem;
}

@media (max-width: 900px) {
    .experimental-pgk-grid {
        grid-template-columns: 1fr;
    }

    .form-group-wide {
        grid-column: auto;
    }

    .experimental-analysis-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
