/* --- 1. GLOBALNA KONFIGURACJA (Edytuj tutaj) --- */
:root {
    /* TYPOGRAFIA */
    --font-primary: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    
    /* ROZMIARY CZCIONEK */
    --size-heading: 22px;      /* 1. Nagłówki */
    --size-text: 16px;         /* 2. Akapity, Inputy, Textarea */
    --size-btn: 16px;          /* 3. Przyciski */
    --size-small: 12px;        /* Stopka, linki */
    
    /* GRUBOŚĆ CZCIONKI */
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-bold: 600;

    /* KOLORY (Opcjonalnie dla porządku) */
    --color-bg: #f8f9fa;
    --color-white: #ffffff;
    --color-text-main: #333333;
    --color-primary: #1a73e8;
    --color-star-active: #ffc107;
    --color-star-inactive: #f4f4f4;
    --color-star-border: #b0b0b0;

    --logo-height: 60px;
}

/* --- 2. RESET I UKŁAD STRONY --- */
body {
    font-family: var(--font-primary);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

/* --- 3. NAGŁÓWKI I TYPOGRAFIA --- */
h1 {
    font-family: var(--font-primary);
    font-size: var(--size-heading);
    font-weight: var(--weight-bold);
    color: var(--color-text-main);
}

h2, h3 {
    font-family: var(--font-primary);
    font-size: var(--size-heading);
    font-weight: var(--weight-bold);
    margin-bottom: 25px;
    color: var(--color-text-main);
}

p {
    font-family: var(--font-primary);
    font-size: var(--size-text);
    line-height: 1.5;
}

/* --- 4. ELEMENTY STRONY --- */
/* header {
    background-color: var(--color-white);
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.logo {
    height: var(--logo-height);
    width: auto;
    display: block;
    margin: 0 auto;
}
    */
header {
    background-color: var(--color-white);
    height: 60px; /* Stała wysokość nagłówka */
    display: flex;
    justify-content: center; /* Centruje zawartość na dużych ekranach */
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky; /* Przykleja nagłówek */
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center; /* Wyrównanie w pionie */
    width: 100%;
    max-width: 450px; /* Ta sama szerokość co główny kontener */
    padding: 0 20px;  /* Odstępy po bokach */
    box-sizing: border-box;
}

.back-link {
    color: var(--color-text-main);
    font-size: 20px; /* Rozmiar strzałki */
    text-decoration: none;
    margin-right: 15px; /* Odstęp między strzałką a tekstem */
    padding: 10px; /* Zwiększa obszar kliknięcia palcem */
    margin-left: -10px; /* Kompensuje padding, aby strzałka była równo z krawędzią */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--color-primary); /* Kolor po najechaniu */
}

.company-name {
    font-family: var(--font-primary);
    font-size: 18px;
    font-weight: var(--weight-medium);
    color: var(--color-text-main);
    white-space: nowrap;      /* Zapobiega łamaniu nazwy w dziwnym miejscu */
    overflow: hidden;         /* Ukrywa nadmiar tekstu */
    text-overflow: ellipsis;  /* Dodaje "..." jeśli nazwa jest za długa */
}

main.container {
    background: var(--color-white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 450px;
    text-align: center;
    box-sizing: border-box;
    margin: 40px auto;
}

footer {
    background-color: var(--color-white);
    padding: 20px;
    text-align: center;
    border-top: 1px solid #eaeaea;
    margin-top: auto;
}

.footer-links a {
    font-family: var(--font-primary);
    font-size: var(--size-small);
    color: #999;
    text-decoration: none;
}

/* --- 5. GWIAZDKI (Styl z obrysem) --- */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    margin-bottom: 30px;
    gap: 8px;
}

.star-rating input { display: none; }

.star-rating label {
    font-size: 30px;
    color: var(--color-star-inactive); /* Jasne tło */
    -webkit-text-stroke: 1px var(--color-star-border); /* Obrys */
    cursor: pointer;
    padding: 0 5px;
    transition: all 0.2s;
}

.star-rating label:before { content: '\2605'; }

/* Aktywne gwiazdki */
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
    color: var(--color-star-active);
    -webkit-text-stroke: 1px #d39e00;
    transform: scale(1.1);
}

/* --- 6. FORMULARZE (Input, Textarea) --- */
textarea, input[type="text"], input[type="email"] {
    font-family: var(--font-primary);
    font-size: var(--size-text);
    width: 100%;
    padding: 16px; /* Padding góra/dół */
    height: 150px; 
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: none;
    box-sizing: border-box;
    margin-bottom: 15px;
    background-color: var(--color-white);
    line-height: 1.5; 
}

/* Licznik znaków */
.char-counter {
    font-size: 10px;
    color: #999;
    text-align: right;
    margin-top: -15px;
    margin-bottom: 15px;
    margin-right: 5px;
}

/* --- 7. PRZYCISKI --- */
button#submit-btn {
    font-family: var(--font-primary);
    font-size: var(--size-btn);
    font-weight: var(--weight-bold);
    width: 100%;
    padding: 14px;
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

button#submit-btn:hover { filter: brightness(0.9); }
button#submit-btn:disabled { background-color: #ccc; cursor: default; }

.custom-file-upload {
    font-family: var(--font-primary);
    font-size: var(--size-text);
    font-weight: var(--weight-medium);
    display: block;
    width: 100%;
    padding: 12px;
    background-color: #e8f0fe;
    color: var(--color-primary);
    border-radius: 25px;
    cursor: pointer;
    margin-bottom: 20px;
    border: none;
    text-align: center;
    box-sizing: border-box;
    transition: background 0.2s;
}

.custom-file-upload:hover { background-color: #d2e3fc; }
input[type="file"] { display: none; }

/* --- 8. LOGIKA BLOKADY I TOOLTIP --- */
.form-wrapper { position: relative; transition: opacity 0.3s; }
.form-wrapper.disabled { opacity: 0.5; }

.form-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: not-allowed;
}

.form-wrapper.disabled .form-overlay { display: block; }

.tooltip {
    font-family: var(--font-primary);
    font-size: var(--size-small);
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    white-space: nowrap;
    z-index: 20;
}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip.show { opacity: 1; visibility: visible; }

/* --- 9. KOMUNIKATY STATUSU --- */
#file-list { font-size: 12px; color: #666; margin-bottom: 15px; text-align: left; }
.success { color: green; margin-top: 15px; font-weight: var(--weight-medium); }
.error {
    color: #d93025;        /* Czerwony */
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    
    margin-top: 15px;      /* Odstęp od miniaturek zdjęć (góra) */
    margin-bottom: 10px;   /* Odstęp od krawędzi kontenera (dół) */
    
    display: block;        /* Dla pewności */
    line-height: 1.4;      /* Lepsza czytelność jeśli tekst jest długi */
}

/* Odstęp całego modułu wgrywania plików od przycisku "Opublikuj" */
.file-upload {
    margin-bottom: 30px; /* To da solidny oddech między zdjęciami a przyciskiem */
}

/* --- 10. RESPONSYWNOŚĆ (MOBILE) --- */
@media (max-width: 600px) {
    main.container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 25px 30px 60px 30px;
        border: none;
        min-height: calc(100vh - 140px); 
    }

    body {
        background-color: var(--color-white);
    }
    
    /* Header ma już style globalne, które pasują do mobile, 
       więc nie musimy tu nic dodawać. */
}

/* --- 11. MINIATURKI ZDJĘĆ --- */
/* --- ZARZĄDZANIE ZDJĘCIAMI --- */
#file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px; /* Troszkę większy odstęp, żeby X nie nachodził na sąsiada */
    margin-top: 15px;
    margin-bottom: 15px;
}

/* 1. Główny kontener (pozycjonuje całość, ale nie przycina) */
.file-wrapper {
    position: relative;
    width: 70px;
    height: 70px;
    /* Usunęliśmy overflow: hidden i border-radius stąd */
}

/* 2. Wewnętrzne pudełko na zdjęcie (ono przycina i ma zaokrąglenia) */
.preview-box {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background-color: #f0f2f5; 
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    overflow: hidden; /* To trzyma zdjęcie i spinner w ryzach */
    position: relative; /* Żeby spinner wiedział gdzie jest środek */
}

/* --- EFEKT LOADING (Teraz dotyczy .preview-box) --- */
.preview-box.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #ddd;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1;
}

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

/* Miniaturka */
.file-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.preview-box.loaded .file-preview { opacity: 1; }
.preview-box.loaded::after { display: none; }

/* 3. Przycisk usuwania (X) - Teraz jest pozycjonowany względem .file-wrapper */
.remove-btn {
    position: absolute;
    top: -8px;    /* Wystaje w górę */
    right: -8px;  /* Wystaje w prawo */
    background-color: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25); /* Mocniejszy cień dla kontrastu */
    transition: background-color 0.2s, transform 0.1s;
    z-index: 10; /* Ważne: musi być nad wszystkim */
}

.remove-btn:hover { background-color: #cc0000; }
.remove-btn:active { transform: scale(0.9); }

/* --- 12. KLAUZULA PRAWNA --- */
.legal-info {
    font-size: 12px;
    color: #888;
    margin-top: 45px;
    line-height: 1.4;
    text-align: center;
}

.legal-info a {
    color: #666;
    text-decoration: underline;
}