/*
 * Konwerter SF - Główne Style
 * ===========================
 * Nowoczesny interfejs używający zmiennych z themes.css
 */

/* ============================================
   Reset i Podstawy
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --pico-font-size: 16px;
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --border-radius-2xl: 1.5rem;
    --border-radius-full: 9999px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--theme-bg-secondary);
    color: var(--theme-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ============================================
   Kontener Główny
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .container {
        padding: 2rem;
    }
}

/* ============================================
   Nagłówek / Header
   ============================================ */
header.main-header {
    background: var(--theme-bg-card);
    border-bottom: 1px solid var(--theme-border);
    padding: 1rem 0;
    margin-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--theme-shadow);
}

header.main-header .container {
    padding-top: 0;
    padding-bottom: 0;
}

header.main-header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--theme-text-primary);
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    background: var(--theme-primary);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-text-inverse);
    font-weight: bold;
}

.nav-menu {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-menu a {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--theme-text-secondary);
    border-radius: var(--border-radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.nav-menu a:hover {
    background-color: var(--theme-bg-secondary);
    color: var(--theme-primary);
}

.nav-menu a.active {
    background-color: var(--theme-bg-tertiary);
    color: var(--theme-primary);
}

.nav-links {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* ============================================
   Przyciski
   ============================================ */
.btn,
button:not(.outline):not(.secondary):not(.ghost),
[role="button"]:not(.outline):not(.secondary):not(.ghost),
input[type="submit"]:not(.outline),
input[type="button"]:not(.outline) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--theme-primary) !important;
    color: var(--theme-text-inverse) !important;
    border-color: var(--theme-primary) !important;
}

.btn:hover,
button:not(.outline):not(.secondary):not(.ghost):hover,
[role="button"]:not(.outline):not(.secondary):not(.ghost):hover,
input[type="submit"]:not(.outline):hover,
input[type="button"]:not(.outline):hover {
    background: var(--theme-primary-dark) !important;
    border-color: var(--theme-primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: var(--theme-shadow);
}

.btn-outline,
button.outline,
[role="button"].outline {
    background: transparent !important;
    color: var(--theme-primary) !important;
    border: 2px solid var(--theme-primary) !important;
}

.btn-outline:hover,
button.outline:hover,
[role="button"].outline:hover {
    background: var(--theme-primary) !important;
    color: var(--theme-text-inverse) !important;
}

.btn-secondary,
button.secondary,
[role="button"].secondary {
    background: var(--theme-secondary) !important;
    color: var(--theme-text-inverse) !important;
    border-color: var(--theme-secondary) !important;
}

.btn-secondary:hover,
button.secondary:hover,
[role="button"].secondary:hover {
    background: var(--theme-secondary-dark) !important;
    border-color: var(--theme-secondary-dark) !important;
}

.btn-ghost,
button.ghost,
[role="button"].ghost {
    background: transparent !important;
    color: var(--theme-text-secondary) !important;
    border: none !important;
}

.btn-ghost:hover,
button.ghost:hover,
[role="button"].ghost:hover {
    background: var(--theme-bg-secondary) !important;
    color: var(--theme-primary) !important;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    text-align: center;
    padding: 4rem 1rem;
    background: var(--theme-gradient-soft);
    border-radius: var(--border-radius-2xl);
    margin-bottom: 3rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--theme-bg-card);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-full);
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
    margin-bottom: 1.5rem;
    box-shadow: var(--theme-shadow);
}

.hero-badge .dot {
    width: 0.5rem;
    height: 0.5rem;
    background: var(--theme-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--theme-text-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero h1 span {
    color: var(--theme-primary);
}

@media (min-width: 768px) {
    .hero h1 {
        font-size: 3.5rem;
    }
}

.hero p {
    font-size: 1.125rem;
    color: var(--theme-text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   Feature Cards
   ============================================ */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.feature-card {
    background: var(--theme-bg-card);
    padding: 2rem;
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--theme-border);
    transition: all var(--transition-normal);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--theme-shadow-lg);
    border-color: var(--theme-primary);
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    background: var(--theme-bg-tertiary);
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--theme-primary);
    font-size: 1.25rem;
}

.feature-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--theme-text-primary);
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--theme-text-muted);
    margin: 0;
}

/* ============================================
   Steps Section
   ============================================ */
.steps-section {
    text-align: center;
    padding: 3rem 0;
}

.steps-section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    color: var(--theme-text-primary);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.step-number {
    width: 3rem;
    height: 3rem;
    background: var(--theme-primary);
    color: var(--theme-text-inverse);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.step h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--theme-text-primary);
    margin-bottom: 0.5rem;
}

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

/* ============================================
   Cards / Articles
   ============================================ */
article,
.card {
    background: var(--theme-bg-card);
    border-radius: var(--border-radius-xl);
    padding: 2rem;
    border: 1px solid var(--theme-border);
    box-shadow: var(--theme-shadow);
}

/* ============================================
   Upload Area
   ============================================ */
.upload-area {
    border: 2px dashed var(--theme-border);
    border-radius: var(--border-radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    transition: all var(--transition-normal);
    background: var(--theme-bg-secondary);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--theme-primary);
    background: var(--theme-bg-tertiary);
}

.upload-area.dragover {
    border-color: var(--theme-primary);
    background: var(--theme-bg-tertiary);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--theme-primary);
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--theme-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--theme-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--theme-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--theme-info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ============================================
   Limit Badge
   ============================================ */
.limit-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    background: var(--theme-bg-secondary);
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--theme-text-secondary);
}

.limit-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--theme-warning);
}

.limit-badge.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--theme-error);
}

/* ============================================
   Status Badges
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--theme-success);
}

.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--theme-error);
}

.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--theme-warning);
}

/* ============================================
   Tables
   ============================================ */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--theme-border);
}

th {
    font-weight: 600;
    color: var(--theme-text-primary);
    background: var(--theme-bg-secondary);
}

tr:hover {
    background: var(--theme-bg-secondary);
}

.history-table {
    font-size: 0.875rem;
}

.history-table td {
    vertical-align: middle;
}

/* ============================================
   Forms
   ============================================ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 2px solid var(--theme-border);
    border-radius: var(--border-radius-md);
    background: var(--theme-bg-card);
    color: var(--theme-text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), 0.1);
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--theme-text-primary);
}

/* ============================================
   Footer
   ============================================ */
footer.main-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--theme-border);
    text-align: center;
    color: var(--theme-text-muted);
    font-size: 0.875rem;
}

/* ============================================
   Theme Switcher
   ============================================ */
.theme-switcher {
    position: relative;
}

.theme-toggle {
    background: var(--theme-bg-secondary);
    border: 1px solid var(--theme-border);
    border-radius: var(--border-radius-md);
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--theme-bg-tertiary);
    border-color: var(--theme-primary);
}

.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--theme-text-secondary);
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--theme-bg-card);
    border: 1px solid var(--theme-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--theme-shadow-lg);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.theme-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.theme-option:first-child {
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.theme-option:last-child {
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.theme-option:hover {
    background: var(--theme-bg-secondary);
}

.theme-option.active {
    background: var(--theme-bg-tertiary);
}

.theme-color {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px solid var(--theme-border);
}

.theme-option span {
    font-size: 0.9rem;
    color: var(--theme-text-primary);
}

/* ============================================
   HTMX Loading States
   ============================================ */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-flex;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--theme-border);
    border-top-color: var(--theme-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--theme-primary); }
.text-secondary { color: var(--theme-text-secondary); }
.text-muted { color: var(--theme-text-muted); }

.bg-primary { background-color: var(--theme-primary); }
.bg-secondary { background-color: var(--theme-bg-secondary); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.hidden { display: none; }
.block { display: block; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .hero {
        padding: 2.5rem 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    header.main-header nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        margin-top: 0.5rem;
    }

    .nav-links {
        order: 2;
    }
}

/* ============================================
   Search Tabs
   ============================================ */
.search-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--theme-bg-secondary);
    padding: 0.5rem;
    border-radius: var(--border-radius-lg);
}

.tab-btn {
    flex: 1;
    padding: 0.875rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--theme-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-btn:hover {
    color: var(--theme-primary);
    background: var(--theme-bg-card);
}

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

/* ============================================
   Search Panels
   ============================================ */
.search-panel {
    display: none;
}

.search-panel.active {
    display: block;
}

/* ============================================
   Form Grid & Search Button
   ============================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.flex-grow {
    flex: 1;
}

/* ============================================
   PNA Search - Large Input Style
   ============================================ */
#pna-form .form-row {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

#pna-form .form-group.flex-grow {
    flex: 1;
}

#pna-form #pna {
    font-size: 1.5rem;
    padding: 1.25rem 1.5rem;
    height: 100%;
    min-height: 4rem;
    text-align: center;
    letter-spacing: 0.15em;
    font-weight: 600;
}

#pna-form .search-btn {
    flex: 1;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    min-height: 4rem;
}

#pna-form .clear-btn {
    padding: 1.25rem 1.5rem;
    min-height: 4rem;
}

/* ============================================
   Clear Button Style
   ============================================ */
.clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--theme-bg-secondary) !important;
    color: var(--theme-text-secondary) !important;
    border: 2px solid var(--theme-border) !important;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.clear-btn:hover {
    background: var(--theme-bg-tertiary) !important;
    border-color: var(--theme-error) !important;
    color: var(--theme-error) !important;
}

.clear-btn svg {
    flex-shrink: 0;
}

/* Form buttons container for address form */
.form-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.form-buttons .search-btn {
    flex: 1;
}

.form-buttons .clear-btn {
    flex-shrink: 0;
}

.search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--theme-primary) !important;
    color: var(--theme-text-inverse) !important;
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--theme-primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: var(--theme-shadow);
}

.search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Map Section
   ============================================ */
.map-section {
    margin-top: 2rem;
}

.map-section.hidden {
    display: none;
}

#map {
    height: 400px;
    border-radius: var(--border-radius-xl);
    z-index: 1;
    box-shadow: var(--theme-shadow);
}

/* ============================================
   Result Cards
   ============================================ */
.result-card {
    background: var(--theme-bg-card);
    border: 1px solid var(--theme-border);
    border-radius: var(--border-radius-xl);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--theme-shadow);
}

.result-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--theme-border);
}

.result-address {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-text-primary);
    margin: 0;
}

.result-count {
    font-size: 0.875rem;
    color: var(--theme-text-muted);
    margin: 0.25rem 0 0 0;
}

.result-warning {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(245, 158, 11, 0.1);
    color: var(--theme-warning);
    border-radius: var(--border-radius-md);
    font-size: 0.875rem;
    font-weight: 500;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--theme-text-muted);
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--theme-primary);
}

/* ============================================
   Court Cards
   ============================================ */
.courts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.court-card {
    background: var(--theme-bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    border-left: 4px solid;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.court-rejonowy {
    border-left-color: #10b981;
}

.court-okregowy {
    border-left-color: #f59e0b;
}

.court-apelacyjny {
    border-left-color: #ef4444;
}

.court-level {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--theme-text-muted);
    margin-bottom: 0.375rem;
}

.court-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--theme-text-primary);
    line-height: 1.4;
}

.court-details {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--theme-border);
}

.court-card.expanded .court-details,
.special-court-card.expanded .court-details {
    display: block;
}

.expand-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    margin-top: 0.75rem;
    font-style: italic;
}

.court-card.expanded .expand-hint,
.special-court-card.expanded .expand-hint {
    display: none;
}

.court-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--theme-text-primary);
}

.court-detail-item:last-child {
    margin-bottom: 0;
}

.detail-icon {
    flex-shrink: 0;
}

.court-detail-item a {
    color: var(--theme-primary);
    word-break: break-all;
}

.court-detail-item a:hover {
    text-decoration: underline;
}

/* Special Courts */
.special-courts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.special-court-card {
    background: var(--theme-bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    border-left: 4px solid #6366f1;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.special-court-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--theme-shadow);
}

.special-court-type {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6366f1;
    margin-bottom: 0.375rem;
}

.special-court-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--theme-text-primary);
}

/* Court Variants */
.court-variant {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--theme-border);
}

.court-variant:first-of-type {
    margin-top: 1rem;
    padding-top: 0;
    border-top: none;
}

.variant-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--theme-primary);
    color: var(--theme-text-inverse);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--border-radius-full);
    margin-bottom: 1rem;
}

.result-coords {
    margin-top: 1.5rem;
    text-align: right;
    font-size: 0.875rem;
    color: var(--theme-text-muted);
}

/* ============================================
   Select2 Custom Styling
   ============================================ */
.select2-container--default .select2-selection--single {
    height: auto;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--theme-border);
    border-radius: var(--border-radius-md);
    background-color: var(--theme-bg-card);
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), 0.1);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--theme-text-primary);
    line-height: 1.5;
    padding-left: 0;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--theme-text-muted);
}

.select2-dropdown {
    border: 2px solid var(--theme-border);
    border-radius: var(--border-radius-md);
    background-color: var(--theme-bg-card);
    box-shadow: var(--theme-shadow-lg);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--theme-border);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
    background-color: var(--theme-bg-secondary);
    color: var(--theme-text-primary);
}

.select2-container--default .select2-results__option {
    padding: 0.5rem 0.75rem;
    color: var(--theme-text-primary);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--theme-primary);
    color: var(--theme-text-inverse);
}

.select2-container--default.select2-container--disabled .select2-selection--single {
    background-color: var(--theme-bg-secondary);
    cursor: not-allowed;
}

.select2-results__options {
    background-color: var(--theme-bg-card);
}

/* ============================================
   Footer Links
   ============================================ */
.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--theme-text-secondary);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--theme-primary);
}

.footer-links span {
    color: var(--theme-text-muted);
}

/* ============================================
   Courts Map Section
   ============================================ */
#courts-map-section {
    margin-top: 2rem;
}

#courts-map-section header p {
    color: var(--theme-text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

#courts-map {
    height: 600px;
    border-radius: var(--border-radius-md);
    border: 2px solid var(--theme-border);
    margin-top: 1rem;
}

/* Map Controls */
.map-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--theme-bg-secondary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--theme-border);
}

.layer-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.layer-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    background: var(--theme-bg-card);
    border: 1px solid var(--theme-border);
    border-radius: var(--border-radius-md);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    user-select: none;
}

.layer-toggle:hover {
    border-color: var(--theme-primary);
}

.layer-toggle input[type="checkbox"] {
    display: none;
}

.layer-toggle input[type="checkbox"]:checked + .toggle-marker {
    box-shadow: 0 0 0 2px var(--theme-bg-card), 0 0 0 4px var(--theme-primary);
}

.layer-toggle input[type="checkbox"]:not(:checked) + .toggle-marker {
    opacity: 0.4;
}

.toggle-marker {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    transition: all var(--transition-fast);
}

.map-info {
    font-size: 0.8rem;
    color: var(--theme-text-muted);
}

.loading-layers {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--theme-border);
    border-top-color: var(--theme-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Leaflet Tooltip Styling */
.court-tooltip {
    background: var(--theme-bg-card, #fff);
    color: var(--theme-text-primary, #1f2937);
    border: 2px solid #3b82f6;
    border-radius: var(--border-radius-md, 8px);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.court-tooltip.court-tooltip-okregowy {
    border-color: #ea580c;
}

.court-tooltip.court-tooltip-apelacyjny {
    border-color: #8b5cf6;
}

.court-tooltip::before {
    display: none;
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius-md, 8px);
    padding: 0;
}

.court-popup {
    padding: 0.5rem;
    min-width: 200px;
}

.court-popup h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--theme-text-primary, #1f2937);
    line-height: 1.3;
}

.court-popup p {
    margin: 0.25rem 0;
    font-size: 0.8rem;
    color: var(--theme-text-secondary, #6b7280);
}

.court-popup p strong {
    color: var(--theme-text-primary, #1f2937);
}

.court-type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm, 4px);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.court-type-badge.okregowy {
    background: #fff7ed;
    color: #c2410c;
}

.court-type-badge.apelacyjny {
    background: #f5f3ff;
    color: #7c3aed;
}

/* ============================================
   Result Map Section (for PNA and Address search)
   ============================================ */
.result-map-section {
    margin-top: 1.5rem;
}

.result-map-section > div[id$="-map"] {
    height: 400px;
    border-radius: var(--border-radius-md);
    border: 2px solid var(--theme-border);
    margin-top: 0.5rem;
}

.result-map-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--theme-bg-secondary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--theme-border);
}

.layer-toggle-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.layer-toggle-small .toggle-marker {
    width: 12px;
    height: 12px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    header.main-header,
    footer.main-footer,
    .theme-switcher,
    .nav-links,
    .search-tabs,
    .map-section,
    #courts-map-section {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .card, article, .result-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .court-card, .special-court-card {
        break-inside: avoid;
    }
}

/* ============================================
   Responsive - Courts Map
   ============================================ */
@media (max-width: 768px) {
    #courts-map {
        height: 400px;
    }

    .result-map-section > div[id$="-map"] {
        height: 300px;
    }

    .map-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .layer-toggles {
        width: 100%;
        flex-direction: column;
    }

    .layer-toggle {
        width: 100%;
        justify-content: flex-start;
    }

    .result-map-controls {
        flex-direction: column;
    }

    .layer-toggle-small {
        width: 100%;
    }
}
