/* =========================================
   PANELE: POGODA I KALENDARZ (WRAPPER)
   ========================================= */
.panels-wrapper {
    display: flex;
    justify-content: center;
    align-items: stretch; /* Default to stretch so they match in height */
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.panels-wrapper:has(.panel-pogody-kontener.expanded) {
    align-items: flex-start; /* Switch to flex-start when weather is expanded so calendar doesn't stretch */
}

/* =========================================
   PANEL POGODY
   ========================================= */
.panel-pogody-kontener {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    display: inline-block;
    width: 100%;
    max-width: 450px;
    flex: 1 1 300px;
    padding: 25px; /* Increased padding */
    border-radius: 15px;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 0.95em;
    border: 1px solid rgba(255, 255, 255, 0.4); /* Stronger border */
    text-align: left;
    box-shadow: var(--shadow-deep), inset 0 0 20px rgba(255,255,255,0.05); /* Inner shadow for glass feel */
    cursor: pointer;
    transition: transform 0.2s;
    min-height: 260px; /* Equal height start */
}

@media (hover: hover) and (pointer: fine) {
    .panel-pogody-kontener:hover {
        transform: scale(1.02);
    }
}

.pogoda-naglowek {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    padding-bottom: 8px;
    text-align: center;
}

.pogoda-detale {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px 15px;
}

.pogoda-detale span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.kliknij-instrukcja {
    text-align: center;
    font-size: 0.8em;
    margin-top: 15px;
    color: #ffd700;
    font-weight: bold;
    animation: pulse 2s infinite;
}

#prognoza-7dni {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed rgba(255, 255, 255, 0.4);
}

.prognoza-tytul-sekcja { font-weight: bold; margin-bottom: 10px; color: #ffd700; text-align: center; }

.prognoza-lista { display: flex; flex-direction: column; gap: 8px; }

.prognoza-wiersz {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 8px;
}

.p-dzien { width: 95px; text-transform: capitalize; font-size: 0.85em; }
.p-emoji { font-size: 1.2em; }
.p-temp { font-weight: bold; width: 80px; text-align: right; font-size: 0.9em; }


/* =========================================
   PANEL KALENDARZA (WIDŻET)
   ========================================= */
.panel-kalendarz-kontener {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    padding: 25px; /* Increased padding */
    border-radius: 15px;
    font-size: 0.95em;
    border: 1px solid rgba(255, 255, 255, 0.4); /* Stronger border */
    text-align: center;
    box-shadow: var(--shadow-deep), inset 0 0 20px rgba(255,255,255,0.05); /* Inner shadow for glass feel */
    transition: transform 0.2s, background-color 0.3s;
    flex: 1 1 300px;
    max-width: 450px;
    width: 100%;
    color: white;
    min-height: 260px;
    cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
    .panel-kalendarz-kontener:hover {
        transform: scale(1.02);
    }
}

.kalendarz-dzien {
    font-size: 3.5em;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.kalendarz-miesiac-rok {
    font-size: 1.2em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 600;
}

.kalendarz-detale {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed rgba(255, 255, 255, 0.4);
    text-align: left;
}

.kalendarz-detale h4 {
    margin: 5px 0 5px;
    font-size: 0.9em;
    color: #ffd700;
}

.kalendarz-detale p {
    margin: 0 0 10px;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Czerwona kartka kalendarza (święta) */
.panel-kalendarz-kontener.swieto {
    background: rgba(231, 76, 60, 0.35);
    border-color: rgba(231, 76, 60, 0.5);
}

.panel-kalendarz-kontener.swieto .kalendarz-dzien {
    color: #ffd700;
}

.kliknij-instrukcja-kalendarz {
    font-size: 0.8em;
    color: #ffd700;
    margin-top: 5px;
    animation: pulse 2s infinite;
}

@media (max-width: 768px) {
    .panels-wrapper {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        gap: 10px;
        /* Inherits align-items: stretch from desktop, and :has(.expanded) -> flex-start */
    }
    .panel-pogody-kontener, .panel-kalendarz-kontener {
        width: 50%;
        max-width: none;
        flex: 1 1 50%; /* Fix for mobile empty space */
        min-height: 260px !important;
        height: auto;
        padding: 15px 10px;
        font-size: 0.85em;
    }

    .pogoda-detale {
        grid-template-columns: 1fr;
    }

    .kalendarz-dzien {
        font-size: 2.5em;
    }

    .kalendarz-miesiac-rok {
        font-size: 1em;
    }
}

/* =========================================
   RESPONSYWNOŚĆ PANELI
   ========================================= */
/* =========================================
   KALENDARZ MODAL
   ========================================= */
#kalendarz-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 10001; /* Higher than header */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.kalendarz-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    width: 100%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    text-align: center;
}

#kalendarz-zamknij {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    color: #333;
    cursor: pointer;
    line-height: 1;
}

.kalendarz-nawigacja {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    margin-top: 10px;
}

.kalendarz-nawigacja button {
    background: none;
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

@media (hover: hover) and (pointer: fine) {
    .kalendarz-nawigacja button:hover {
        background-color: #f0f0f0;
        border-color: #aaa;
    }
}

.kalendarz-data-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#kalendarz-tytul {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--kolor-ciemny);
}

#kalendarz-input {
    border: 1px solid #ccc;
    padding: 5px;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
}

#kalendarz-modal-detale h4 {
    margin-top: 15px;
    margin-bottom: 5px;
    color: #555;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

#kalendarz-modal-detale p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

#kalendarz-modal-detale .swieto-modal {
    color: #d32f2f;
    font-weight: bold;
    font-size: 1.3rem;
    margin-bottom: 10px;
    display: block;
}

/* =========================================
   PANEL ADMINISTRATORA
   ========================================= */
.admin-panel {
    background: #fff;
    border: 2px solid var(--kolor-glowny);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-header h2 {
    margin: 0;
    border: none;
    padding: 0;
    font-size: 1.5em;
    color: var(--kolor-ciemny);
}

.admin-user-info {
    font-size: 0.9em;
    color: #777;
    font-weight: bold;
}

.admin-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.btn-duzy {
    padding: 20px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: var(--kolor-glowny);
    color: white;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

@media (hover: hover) and (pointer: fine) {
    .btn-duzy:hover {
        background: var(--kolor-hover);
        transform: translateY(-3px);
    }
}

.btn-warning {
    background: #f39c12;
}

@media (hover: hover) and (pointer: fine) {
    .btn-warning:hover {
        background: #d35400;
    }
}

.btn-wyloguj {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
}

/* Formularze Admina */
.admin-input, .admin-textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
}

.admin-textarea {
    min-height: 120px;
    resize: vertical;
}

input[type="file"]::file-selector-button {
    background: var(--kolor-glowny);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 15px;
    font-weight: bold;
    font-family: inherit;
    transition: background 0.3s;
}

@media (hover: hover) and (pointer: fine) {
    input[type="file"]::file-selector-button:hover {
        background: var(--kolor-hover);
    }
}

/* Edytor Blokowy */
.editor-controls {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.editor-controls button {
    background: white;
    border: 1px solid #ccc;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

@media (hover: hover) and (pointer: fine) {
    .editor-controls button:hover {
        background: #e0eaf5;
        border-color: var(--kolor-glowny);
    }
}

#editor-blocks-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.editor-block {
    background: #fff;
    border: 1px solid #ddd;
    border-left: 4px solid var(--kolor-glowny);
    padding: 15px;
    border-radius: 4px;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.block-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.85em;
    color: #999;
    font-weight: bold;
    text-transform: uppercase;
}

.btn-remove-block {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.2em;
}

.preview-img {
    max-width: 200px;
    max-height: 200px;
    display: block;
    margin-top: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.html-block-preview {
    font-size: 0.8em;
    color: #e67e22;
    margin-bottom: 5px;
}
.admin-textarea.disabled {
    background-color: #eee;
    color: #777;
    cursor: not-allowed;
}

/* Menedżer Galerii */
.admin-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 6px;
    border: 1px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-list-item > span {
    flex: 1 1 100%;
    word-break: break-word;
}

.admin-list-item > div {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-delete {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.gallery-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

.gallery-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
}

.gallery-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.gallery-preview-item button {
    position: absolute;
    top: -5px;
    right: -5px;
    background: red;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Admin Controls on public items */
.admin-item-controls {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #ccc;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.btn-edit-item {
    background: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

.btn-edit {
    background: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

.btn-save-edit {
    background: #27ae60;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

.btn-cancel-edit {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

.btn-delete-item {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

/* --- STYLE DLA SENIORA (ADMIN) --- */
.admin-step {
    background: #fdfdfd;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}
.admin-label-big {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--kolor-ciemny);
    margin-bottom: 10px;
}
.admin-input-big, .admin-textarea-big {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid #ccc;
    border-radius: 8px;
    margin-bottom: 5px;
}
.admin-input-big:focus, .admin-textarea-big:focus {
    border-color: var(--kolor-glowny);
    background-color: #f0f8ff;
    outline: none;
}
.admin-hint {
    font-style: italic;
    color: #555;
    margin-bottom: 15px;
}
.editor-controls-big {
    background: #eef2f5;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px dashed #bdc3c7;
}
.editor-controls-big span {
    display: block;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1em;
}
.buttons-row {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}
.btn-block-add {
    background: white;
    border: 2px solid var(--kolor-glowny);
    color: var(--kolor-glowny);
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    flex: 1 1 120px;
    transition: 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
@media (hover: hover) and (pointer: fine) {
    .btn-block-add:hover {
        background: var(--kolor-glowny);
        color: white;
        transform: scale(1.05);
    }
}
.form-actions-big {
    display: flex;
    flex-direction: column-reverse;
    gap: 15px;
    margin-top: 30px;
}
.btn-zapisz-big {
    background: #27ae60;
    color: white;
    border: none;
    padding: 20px;
    font-size: 1.3em;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    width: 100%;
    text-transform: uppercase;
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}
.btn-anuluj-big {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 15px;
    font-size: 1.1em;
    border-radius: 50px;
    cursor: pointer;
    width: 100%;
}
@media (min-width: 600px) {
    .form-actions-big {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* --- LIVE PREVIEW --- */
.preview-section {
    background-color: #e3e8ee;
    border: 3px dashed #bdc3c7;
}

.preview-header {
    text-align: center;
    color: var(--kolor-glowny);
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#live-preview-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    max-width: 500px;
    margin: 0 auto;
}

#live-preview-card .news-content {
    padding: 20px;
}
.btn-admin-list-action {
    background: var(--kolor-glowny);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    transition: background 0.2s;
}
@media (hover: hover) and (pointer: fine) {
    .btn-admin-list-action:hover {
        background: var(--kolor-hover);
    }
}

/* =========================================
   POWIADOMIENIA PUSH (ADMIN)
   ========================================= */
#btn-admin-send-push {
    background: #8e44ad;
    box-shadow: 0 4px 6px rgba(142, 68, 173, 0.3);
}

@media (hover: hover) and (pointer: fine) {
    #btn-admin-send-push:hover {
        background: #9b59b6 !important;
        transform: translateY(-3px);
    }
}

#form-push-notification .btn-zapisz-big {
    background: #8e44ad !important;
    box-shadow: 0 5px 15px rgba(142, 68, 173, 0.4);
}

@media (hover: hover) and (pointer: fine) {
    #form-push-notification .btn-zapisz-big:hover {
        background: #9b59b6 !important;
        transform: scale(1.05);
    }
}

/* =========================================
   USUNIĘTE ELEMENTY (SOFT DELETE)
   ========================================= */
.deleted-item {
    opacity: 0.7;
    filter: grayscale(80%);
    background-color: #fce4e4 !important;
    border: 2px dashed #c0392b !important;
}

.deleted-item .news-img, .deleted-item .folder-ikona {
    opacity: 0.5;
}

/* =========================================
   LOADER / SPINNER
   ========================================= */
.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--kolor-glowny);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}
