/* Plik: assets/css/style.css */

/* --- Podstawowe Style --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
    color: #374151;
    margin: 0;
    line-height: 1.6;
}

/* ... (reszta stylów z poprzedniej wersji) ... */

/* --- Nagłówek --- */
.admin-header,
.main-header-public {
    background-color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.admin-header .container,
.main-header-public .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header-inner {
    /* Dodatkowa klasa dla wewnętrznego flexboxa w admin header */
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.site-title-header-public,
.admin-title a {
    font-size: 1.5rem;
    /* Zmniejszone dla admina */
    font-weight: 700;
    color: #2563eb;
}

.admin-title a:hover {
    text-decoration: none;
}

.admin-user-info {
    margin-right: 1rem;
    color: #4b5563;
}

.nav-link-public {
    margin-left: 1rem;
}


/* --- Przyciski --- */
.btn {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    border-radius: 0.375rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    border: 1px solid transparent;
    line-height: 1.25;
    /* Dla lepszego wyglądu tekstu w przycisku */
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
}

/* --- Nawigacja Zakładek (Panel Admina) --- */
.nav-tabs-container {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.nav-tab-custom {
    padding: 0.75rem 1rem;
    border-bottom: 3px solid transparent;
    /* Grubsza linia dla aktywnej */
    cursor: pointer;
    color: #4b5563;
    font-weight: 500;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -1px;
    /* Aby linia była na równi z border-bottom kontenera */
}

.nav-tab-custom:hover {
    color: #1d4ed8;
}

.nav-tab-custom.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    font-weight: 600;
}

/* --- Ogólne Sekcje i Karty --- */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1f2937;
}

.subsection-title {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: #1f2937;
}

.subsection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.card-like {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.list-container {
    max-height: 15rem;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
}

.list-container-files {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.5rem;
    min-height: 200px;
}

.small-text-info {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.text-highlight {
    color: #2563eb;
    font-weight: 500;
}

.error-message {
    color: #ef4444;
    text-align: center;
    padding: 1rem;
}

.loading-message {
    text-align: center;
    padding: 1rem;
    color: #6b7280;
}

.empty-table-message,
.empty-list-message {
    text-align: center;
    color: #6b7280;
    padding: 1rem;
    font-style: italic;
}


/* --- Listowanie Postów (Publiczne i Panel Admina) --- */
.post-grid,
.admin-post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.post-card-item,
.admin-post-card-item {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.post-card-item:hover,
.admin-post-card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.post-image-link {
    display: block;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card-item:hover .post-image,
.admin-post-card-item:hover .post-image {
    transform: scale(1.05);
}

.post-card-content,
.admin-post-card-content {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-card-title,
.admin-post-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.post-card-title a,
.admin-post-card-title a {
    color: #1d4ed8;
}

.post-card-title a:hover,
.admin-post-card-title a:hover {
    color: #1e40af;
    text-decoration: none;
}

.post-meta,
.admin-post-meta {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.post-excerpt,
.admin-post-excerpt {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.post-read-more {
    margin-top: auto;
}

.post-read-more a {
    color: #2563eb;
    font-weight: 600;
}

.post-read-more a:hover {
    color: #1d4ed8;
}

.admin-post-actions {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.status-public {
    color: #16a34a;
    font-weight: 500;
}

.status-hidden {
    color: #dc2626;
    font-weight: 500;
}

@media (max-width: 639px) {
    .admin-post-grid .admin-post-card-item:not(:last-child) {
        margin-bottom: 1.5rem;
        border-bottom: 1px solid #e5e7eb;
        padding-bottom: 1.5rem;
        border-radius: 0;
        /* Usuń zaokrąglenie, jeśli jest border-bottom */
        box-shadow: none;
        /* Usuń cień, jeśli jest border-bottom */
    }

    .admin-post-grid .admin-post-card-item:hover {
        transform: none;
        /* Wyłącz efekt hover na mobilnych dla tego przypadku */
    }
}

/* --- Stopka --- */
.footer-public,
.admin-footer {
    background-color: #1f2937;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2.5rem;
}

/* --- Modale --- */
.modal-custom {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 50;
}

.modal-custom.visible {
    display: flex;
}

.modal-content-custom {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 42rem;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    /* Dla pozycjonowania przycisku zamknięcia */
}

.modal-content-custom.modal-sm {
    max-width: 32rem;
}

.modal-title-custom {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #2563eb;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    font-size: 1rem;
    box-sizing: border-box;
    /* Ważne dla inputów */
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

.form-textarea {
    min-height: 120px;
}

.image-preview {
    margin-top: 0.5rem;
    max-height: 10rem;
    border-radius: 0.25rem;
    display: none;
    border: 1px solid #e5e7eb;
}

.radio-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.radio-label {
    display: flex;
    align-items: center;
}

.radio-label span {
    margin-left: 0.5rem;
    font-size: 0.875rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* --- Zarządzanie Plikami (CMS & Server Browser) --- */
.files-grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .files-grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

.files-col-span-1 {
    grid-column: span 1 / span 1;
}

.files-col-span-2 {
    grid-column: span 1 / span 1;
}

@media (min-width: 768px) {
    .files-col-span-2 {
        grid-column: span 2 / span 2;
    }
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
    text-align: left;
}

.table th {
    background-color: #f9fafb;
    color: #374151;
    font-weight: 600;
}

.server-file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.server-file-item {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.server-file-item:last-child {
    border-bottom: none;
}

.server-file-item a {
    display: block;
    color: #374151;
    text-decoration: none;
}

.server-file-item a:hover {
    background-color: #f9fafb;
}

.server-file-item.item-type-dir a {
    font-weight: 500;
}

.server-file-item.item-type-parent a {
    color: #6b7280;
}

.server-file-item.image-file a::after {
    content: " (obraz)";
    font-style: italic;
    color: #9ca3af;
    margin-left: 0.5em;
}


/* --- NOWE STYLE DLA GALERII OBRAZÓW --- */
.image-gallery-modal {
    display: none;
    /* Domyślnie ukryty */
    position: fixed;
    z-index: 1000;
    /* Wysoki z-index, aby był na wierzchu */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    /* Umożliwia przewijanie, jeśli obraz jest za duży */
    background-color: rgba(0, 0, 0, 0.9);
    /* Wyczernione tło */
    justify-content: center;
    /* Wyśrodkowanie w poziomie */
    align-items: center;
    /* Wyśrodkowanie w pionie */
}

.gallery-image {
    display: block;
    max-width: 80vw;
    /* 80% szerokości okna przeglądarki */
    max-height: 80vh;
    /* 80% wysokości okna przeglądarki */
    margin: auto;
    /* Dodatkowe centrowanie, jeśli obraz jest mniejszy */
    border: 3px solid white;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    /* Sugeruje, że można kliknąć */
}

.gallery-close-btn {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001;
}

.gallery-close-btn:hover,
.gallery-close-btn:focus {
    color: #bbb;
    text-decoration: none;
}

.gallery-nav-btn {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    /* Połowa wysokości przycisku */
    color: white;
    font-weight: bold;
    font-size: 28px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    -webkit-user-select: none;
    background-color: rgba(0, 0, 0, 0.3);
    border: none;
    z-index: 1001;
}

.gallery-nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

.gallery-prev-btn {
    left: 10px;
    border-radius: 3px 0 0 3px;
}

.gallery-next-btn {
    right: 10px;
    border-radius: 0 3px 3px 0;
}

.gallery-filename {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #f1f1f1;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Style dla strony post_view.php */
.post-view-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.post-view-title {
    font-size: 2.25rem;
    font-weight: bold;
    color: #2563eb;
    margin-bottom: 1rem;
}

.post-view-meta {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.post-view-image {
    width: 100%;
    max-height: 450px;
    object-fit: cover;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
}

.post-view-content {
    line-height: 1.75;
    font-size: 1.125rem;
    white-space: pre-wrap;
}

.post-view-back-link {
    display: inline-block;
    margin-top: 2rem;
    color: #2563eb;
    text-decoration: none;
}

.post-view-back-link:hover {
    text-decoration: underline;
}