/**
 * PRE-MAP DATA PANEL STYLES
 * NOWA KONCEPCJA: Mały sticky panel NAD mapą (nie fullscreen!)
 * 
 * @version 2.0.0 - REDESIGN!
 * @created 2026-03-01
 * @updated 2026-03-01 - Panel NAD mapą zamiast fullscreen overlay
 * 
 * Design:
 * - Mały kompaktowy panel (sticky bottom lub top)
 * - Nie blokuje interakcji z mapą
 * - z-index wyższy niż mapa (1000000)
 * - Minimalistyczny design
 */

/* ====================================================================================
   PANEL - Mały sticky kontener NAD mapą
   ==================================================================================== */
.pre-map-data-panel {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 560px;
    max-width: calc(100vw - 20px);
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow:
        0 0 0 1px rgba(254, 204, 1, 0.25),
        0 -4px 6px rgba(0, 0, 0, 0.04),
        0 -12px 40px rgba(0, 0, 0, 0.14),
        0 0 60px rgba(254, 204, 1, 0.08);
    z-index: 1000000;
    overflow: hidden;
    animation: panelSlideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes panelSlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(40px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ANIMACJA: Panel "wynurza się" z głębi mapy — jak paczka w doręczeniu.
   Zaczyna niewidoczny i mały (jak punkt na mapie), potem rośnie spokojnie.
   Efekt: blur → ostrość, mały → normalny, przezroczysty → pełny */
@keyframes panelEmerge {
    0% {
        transform: translate(-50%, -46%) scale(0.88);
        opacity: 0;
        filter: blur(8px);
    }
    40% {
        opacity: 0.6;
        filter: blur(2px);
    }
    70% {
        transform: translate(-50%, -50.5%) scale(1.01);
        filter: blur(0);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

/* ====================================================================================
   HEADER - Kompaktowy nagłówek panelu (bez przycisku X)
   ==================================================================================== */
.panel-header {
    padding: 14px 52px;
    background: linear-gradient(135deg, #FECC01 0%, #FFD700 100%);
    border-bottom: 2px solid #FFA500;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.panel-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin: 0;
    text-align: center;
}

/* ====================================================================================
   PRZYCISK ZAMKNIJ (X) - niebieski styl
   ==================================================================================== */
.panel-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 30px;
    height: 30px;
    background: rgba(0, 123, 255, 0.1);
    border: 2px solid #007bff;
    border-radius: 50%;
    color: #007bff;
    font-size: 20px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.panel-close-btn:hover {
    background: #007bff;
    color: white;
    transform: scale(1.1);
}

/* ====================================================================================
   PASEK FLAG KRAJÓW - pod headerem
   ==================================================================================== */
.panel-country-flags {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f8f8f8 0%, #fff 100%);
    border-bottom: 1px solid #e5e5e5;
    flex-wrap: wrap;
}

.panel-flag-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 30px;
    padding: 4px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.panel-flag-btn:hover {
    opacity: 1;
    border-color: #FECC01;
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(254, 204, 1, 0.3);
}

.panel-flag-btn.active {
    opacity: 1;
    border-color: #FECC01;
    background: #FFF9E0;
    box-shadow: 0 0 0 2px rgba(254, 204, 1, 0.3);
}

.panel-flag-btn svg {
    width: 24px !important;
    height: 18px !important;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

.panel-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pre-popup-close:hover {
    background: #f5f5f5;
    color: #333;
    transform: scale(1.1);
}

.pre-popup-close:active {
    transform: scale(0.95);
}

/* ====================================================================================
   WYBÓR KRAJU - Grid z flagami
   ==================================================================================== */
.pre-popup-countries {
    padding: 24px;
    font-size: 28px;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.panel-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

/* ====================================================================================
   FORMULARZ - Kompaktowy w panelu
   ==================================================================================== */
.panel-form {
    padding: 20px;
    max-height: 65vh; /* Zwiększone z 60vh - więcej miejsca na 4 pola */
    overflow-y: auto;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px; /* Odstęp między polami */
}

.form-row .half-width {
    flex: 1;
    min-width: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.required {
    color: #dc3545;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #FECC01;
    box-shadow: 0 0 0 3px rgba(254, 204, 1, 0.15);
}

/* ====================================================================================
   POLE TELEFONU - Flaga + Prefix + Input (FINALNA WERSJA!)
   ==================================================================================== */
.phone-input {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.phone-flag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px; /* Stała wysokość */
    flex-shrink: 0;
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
    line-height: 1;
}

/* SVG flaga wewnątrz phone-flag */
.phone-flag svg {
    width: 32px !important;
    height: 24px !important;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.phone-flag:hover {
    transform: scale(1.1);
    border-color: #FECC01;
    box-shadow: 0 2px 8px rgba(254, 204, 1, 0.3);
}

.phone-prefix {
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease;
    flex-shrink: 0;
    width: 75px; /* Mniej miejsca bo flaga OBOK */
    box-sizing: border-box;
    font-weight: 600;
    color: #333;
}

.phone-prefix:focus {
    outline: none;
    border-color: #FECC01;
    box-shadow: 0 0 0 3px rgba(254, 204, 1, 0.15);
}

.phone-prefix:focus + .phone-flag,
.phone-input:focus-within .phone-flag {
    border-color: #FECC01;
}

.phone-prefix option {
    font-size: 14px;
    padding: 8px 5px;
}

.phone-input input[type="tel"] {
    flex: 1; /* Zajmij resztę przestrzeni */
    min-width: 150px !important; /* Dostosowane do nowej szerokości panelu */
    width: auto !important; /* Override width: 100% */
    max-width: none !important; /* Usuń ewentualne ograniczenia */
}

/* ====================================================================================
   BŁĘDY WALIDACJI
   ==================================================================================== */
.error-msg {
    display: none;
    margin-top: 4px;
    font-size: 12px;
    color: #dc3545;
}

.error-msg:not(:empty) {
    display: block;
}

/* ====================================================================================
   PRZYCISK SUBMIT
   ==================================================================================== */
.panel-submit {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #00a32a 0%, #008822 100%);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
    box-shadow: 0 4px 12px rgba(0, 163, 42, 0.25);
}

.panel-submit:hover {
    background: linear-gradient(135deg, #00b530 0%, #009925 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 163, 42, 0.35);
}

.panel-submit:active {
    transform: translateY(0);
}

/* ====================================================================================
   KCIUK W GÓRĘ + INSTRUKCJE - Potwierdzenie zapisania w tym samym panelu
   ==================================================================================== */
.thumbs-up-confirmation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumbs-up-confirmation .thumbs-icon {
    font-size: 80px;
    margin-bottom: 16px;
    animation: thumbsPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes thumbsPop {
    0% {
        transform: scale(0.3) rotate(-20deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.thumbs-up-confirmation .thumbs-text {
    font-size: 24px;
    font-weight: 700;
    color: #00a32a;
    margin-bottom: 20px;
    animation: fadeInUp 0.4s ease 0.2s backwards;
}

.thumbs-up-confirmation .next-step-arrow {
    font-size: 32px;
    color: #FECC01;
    margin-bottom: 12px;
    animation: bounceDown 1.5s ease-in-out 0.5s infinite;
}

@keyframes bounceDown {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(10px);
    }
}

.thumbs-up-confirmation .next-step-text {
    font-size: 16px;
    font-weight: 600;
    color: #666;
    text-align: center;
    animation: fadeInUp 0.4s ease 0.6s backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====================================================================================
   RESPONSIVE - Mobile tylko na NAPRAWDĘ małych ekranach
   ==================================================================================== */ */
@media (max-width: 520px) {
    .pre-map-data-panel {
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: calc(100vw - 20px);
        max-width: none;
    }
    
    .form-row {
        flex-direction: column; /* Na małym mobile - kolumna */
        gap: 12px;
    }
    
    .phone-input {
        flex-direction: row; /* Telefon zawsze obok siebie */
    }
    
    .phone-prefix {
        width: 85px; /* Trochę mniej na mobile */
    }
}

.pre-popup-success h3 {
    margin: 0 0 16px 0;
    font-size: 28px;
    color: #00a32a;
    font-weight: 600;
}

.success-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 24px 0;
    text-align: left;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.summary-value {
    font-size: 14px;
    color: #333;
    font-weight: 600;
    text-align: right;
}

.success-message {
    font-size: 16px;
    color: #555;
    line-height: 1.6;
    margin: 24px 0;
}

.pre-popup-proceed {
    background: #00a32a;
    color: #fff;
}

.pre-popup-proceed:hover {
    background: #00b831;
    box-shadow: 0 4px 12px rgba(0, 163, 42, 0.3);
}

/* ====================================================================================
   RESPONSYWNOŚĆ - Mobile & Tablet
   ==================================================================================== */
@media (max-width: 768px) {
    .pre-map-popup-overlay {
        padding: 10px;
    }
    
    .pre-map-popup-container {
        border-radius: 8px;
        max-height: 95vh;
    }
    
    .pre-popup-header {
        padding: 16px;
    }
    
    .pre-popup-header h2 {
        font-size: 20px;
    }
    
    .pre-popup-countries {
        padding: 16px;
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .country-btn {
        padding: 8px 4px;
    }
    
    .country-flag {
        font-size: 28px;
    }
    
    /* SVG flagi w przyciskach krajów */
    .country-flag svg {
        width: 26px !important;
        height: 20px !important;
        border-radius: 3px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    }
    
    .country-name {
        font-size: 11px;
    }
    
    .pre-popup-form {
        padding: 16px;
    }
    
    .pre-popup-success {
        padding: 24px 16px;
    }
    
    .success-icon {
        font-size: 60px;
    }
    
    .pre-popup-success h3 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .pre-popup-header h2 {
        font-size: 18px;
    }
    
    .pre-popup-countries {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .phone-input {
        flex-direction: column;
    }
    
    .phone-prefix {
        width: 100%;
    }
    
    .summary-item {
        flex-direction: column;
        gap: 4px;
    }
    
    .summary-value {
        text-align: left;
    }
}

/* ====================================================================================
   DOSTĘPNOŚĆ - Focus states dla keyboard navigation
   ==================================================================================== */
.country-btn:focus,
.pre-popup-submit:focus,
.pre-popup-proceed:focus {
    outline: 3px solid #FECC01;
    outline-offset: 2px;
}

.form-group input:focus {
    outline: none;
    border-color: #FECC01;
    box-shadow: 0 0 0 3px rgba(254, 204, 1, 0.2);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pre-map-popup-container {
        border: 2px solid #000;
    }
    
    .country-btn {
        border-width: 3px;
    }
    
    .form-group input {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .pre-map-popup-overlay,
    .pre-map-popup-container,
    .success-icon,
    .country-btn,
    .pre-popup-submit,
    .pre-popup-proceed {
        animation: none;
        transition: none;
    }
}

/* ====================================================================================
   DARK MODE SUPPORT (opcjonalnie)
   ==================================================================================== */
@media (prefers-color-scheme: dark) {
    .pre-map-popup-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
    
    /* Możesz dodać dark mode styles tutaj jeśli potrzebne */
}

/* ====================================================================================
   PRINT - Ukryj popup przy drukowaniu
   ==================================================================================== */
@media print {
    .pre-map-popup-overlay {
        display: none !important;
    }
}

/* ====================================================================================
   WELCOME CONTENT - STYLING DLA PIERWSZEGO POPUPU (WELCOME MESSAGE)
   ==================================================================================== */
.welcome-content {
    padding: 24px;
    text-align: center;
    max-height: 70vh;
    overflow-y: auto;
}

.welcome-logo {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.welcome-logo img {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.welcome-logo img:hover {
    transform: scale(1.05);
}

.welcome-text {
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

.welcome-text p {
    margin-bottom: 16px;
    text-align: left;
}

.welcome-text p:last-child {
    margin-bottom: 0;
}

/* Special styling for the warning message */
.welcome-text p[style*="background"] {
    margin: 20px 0 !important;
    text-align: center !important;
}

/* ====================================================================================
   WELCOME SUBMIT BUTTON - STYLING DLA PRZYCISKU KONTYNUUJ
   ==================================================================================== */
.welcome-content .panel-submit {
    margin-top: 24px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.welcome-content .panel-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.4);
}

.welcome-content .panel-submit:active {
    transform: translateY(0);
}
