/* ===== CSS VARIABLES ===== */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius-xs: 3px;
    --radius-sm: 4px;
    --radius: 8px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --sidebar-width: 380px;
    --details-width: 400px;
    --header-height: 56px;
    /* Transitions */
    --transition-fast: 0.15s;
    --transition-normal: 0.2s;
    /* Typography scale */
    --text-3xs: 9px;
    --text-2xs: 10px;
    --text-xs: 11px;
    --text-sm: 12px;
    --text-base: 13px;
    --text-md: 14px;
    --text-lg: 16px;
    --text-xl: 18px;
    /* Accent colors */
    --info: #3b82f6;
    --purple: #8b5cf6;
    /* Surface & text tokens (overridden in dark.css) */
    --bg-surface: #ffffff;
    --bg-surface-alt: #f9fafb;
    --text-color: #111827;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
    --header-bg: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    --header-text: #ffffff;
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Global focus-visible outline for all interactive elements */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Remove default outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    font-size: var(--text-md);
    line-height: 1.5;
}

/* ===== HEADER ===== */
.app-header {
    height: var(--header-height);
    background: var(--header-bg);
    color: var(--header-text);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    box-shadow: var(--shadow-md);
    z-index: 100;
    min-width: 0;
    overflow: visible;
}

.app-header:has(.header-menu.open) {
    z-index: 10050;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 0 1 auto;
    min-width: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--text-xl);
    font-weight: 700;
}

.logo i {
    font-size: 24px;
    color: var(--primary-light);
}

.header-stats {
    display: flex;
    gap: 16px;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.header-stats .stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-base);
    color: var(--gray-300);
}

.header-stats .stat i {
    color: var(--gray-400);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--gray-600);
    margin: 0 8px;
}

/* ===== HEADER MENUS (Plik / Opcje) ===== */
.header-menus {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    overflow: visible;
}

.header-menu {
    position: relative;
    z-index: 1;
}

.header-menu.open {
    z-index: 10051;
}

.header-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    color: var(--header-text);
    transition: background var(--transition-fast);
}

.header-menu-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.header-menu-caret {
    font-size: 10px;
    opacity: 0.75;
}

.header-menu-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: var(--bg-surface);
    color: var(--gray-800);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    padding: 6px 0;
    z-index: 11000;
}

.header-menu.open .header-menu-panel {
    display: block;
}

.header-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 14px;
    border: none;
    background: transparent;
    font-size: var(--text-base);
    color: var(--gray-800);
    cursor: pointer;
    text-align: left;
}

.header-menu-item:hover {
    background: var(--gray-50);
}

.header-menu-item-accent {
    color: #6d28d9;
    font-weight: 600;
}

.header-menu-separator {
    height: 1px;
    background: var(--gray-200);
    margin: 6px 0;
}

.header-menu-panel .header-tool-badge {
    margin-left: auto;
}

.header-tool {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.75);
    transition: all 0.15s ease;
    white-space: nowrap;
    position: relative;
    line-height: 1;
}

.header-tool:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

.header-tool i {
    font-size: 13px;
    width: 14px;
    text-align: center;
}

.header-tool-badge {
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-weight: 700;
    padding: 0 4px;
    margin-left: 2px;
}

.header-tool-badge.badge-danger {
    background: #ef4444;
}

/* Shooting button — amber accent */
#toolbar-shooting-btn {
    color: #fbbf24;
}

#toolbar-shooting-btn:hover {
    background: rgba(251,191,36,0.2);
}

#toolbar-shooting-btn .header-tool-badge {
    background: #f59e0b;
    color: #fff;
}

/* AI Agent — indigo accent */
.header-tool-accent {
    background: rgba(99,102,241,0.25);
    color: #c7d2fe;
}

.header-tool-accent:hover {
    background: rgba(99,102,241,0.45);
    color: #fff;
}

/* Eksport zmian — green accent */
.header-tool-success {
    background: rgba(34,197,94,0.2);
    color: #86efac;
}

.header-tool-success:hover {
    background: rgba(34,197,94,0.4);
    color: #fff;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn:hover {
    background: var(--gray-200);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-ghost {
    background: transparent;
    color: inherit;
}

.btn-ghost:hover {
    background: rgba(255,255,255,0.1);
}

.btn-icon {
    padding: 8px 12px;
}

.btn-icon-only {
    padding: 8px 10px;
}

.btn-icon-only span {
    display: none;
}

.btn-icon span {
    margin-left: 4px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: var(--text-xs);
}

.btn-sm {
    padding: 6px 12px;
    font-size: var(--text-sm);
}

.btn-block {
    width: 100%;
}

/* ===== MAIN LAYOUT ===== */
.app-main {
    display: flex;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}


/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 280px;
        --details-width: 320px;
    }
}

@media (max-width: 1320px) {
    .header-left {
        gap: 12px;
    }
}

@media (max-width: 900px) {
    .header-stats {
        display: none;
    }
    
    .details-panel {
        position: fixed;
        right: 0;
        top: var(--header-height);
        bottom: 0;
        z-index: 100;
        box-shadow: var(--shadow-lg);
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-xs);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Podświetlenie markera na mapie przy hover w schedulerze */
.marker-highlight-pulse {
    animation: marker-pulse 0.8s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 6px currentColor);
}

@keyframes marker-pulse {
    0% { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(1.25); opacity: 1; }
}

/* Respektuj preferencję użytkownika dot. ruchu */
@media (prefers-reduced-motion: reduce) {
    .marker-highlight-pulse,
    .btn,
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== ONBOARDING TOUR ===== */
.tour-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 100000;
}

.tour-highlight {
    position: fixed;
    border-radius: var(--radius);
    box-shadow: 0 0 0 4px var(--primary), 0 0 0 9999px rgba(0, 0, 0, 0.5);
    z-index: 100001;
    pointer-events: none;
    transition: all 0.3s ease;
}

.tour-tooltip {
    position: fixed;
    z-index: 100002;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 20px 24px;
    max-width: 360px;
    min-width: 280px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
}

.tour-tooltip-text {
    margin-bottom: 14px;
    font-weight: 500;
}

.tour-tooltip-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tour-step-counter {
    font-size: var(--text-sm);
    color: var(--gray-500);
    font-weight: 600;
}

.tour-tooltip-btns {
    display: flex;
    gap: 6px;
}
