/* ============================================================================
   GAZETKA SZKOLNA — Style (KM-GAZETKA)
   ============================================================================ */

/* ---- RESET & BASE ---- */
.gazetka-header,
.gazetka-categories,
.gazetka-main,
.gazetka-sidebar,
.gazetka-modal-content {
    color: #333;
}

/* ---- HEADER ---- */
.gazetka-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #2c3e50;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    flex-wrap: wrap;
    gap: 8px;
}

.gazetka-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.gazetka-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gazetka-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #ecf0f1;
    letter-spacing: 0.5px;
}

.gazetka-back-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #ecf0f1;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.gazetka-back-btn:hover {
    background: rgba(255,255,255,0.25);
}

.gazetka-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #27ae60;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.2s;
}
.gazetka-btn-primary:hover {
    background: #219a52;
}

/* ---- CATEGORY NAV ---- */
.gazetka-categories {
    display: flex;
    gap: 6px;
    padding: 12px 24px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gazetka-cat-btn {
    background: #fff;
    border: 1px solid #ddd;
    color: #555;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: all 0.2s;
}
.gazetka-cat-btn:hover {
    background: #ecf0f1;
    border-color: #bbb;
}
.gazetka-cat-btn.active {
    background: #2c3e50;
    color: #fff;
    border-color: #2c3e50;
}

/* ---- MAIN LAYOUT ---- */
.gazetka-main {
    display: flex;
    gap: 24px;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.gazetka-articles {
    flex: 1;
    min-width: 0;
}

/* ---- EMPTY STATE ---- */
.gazetka-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.gazetka-empty-state h2 {
    color: #666;
    margin-bottom: 8px;
}

/* ---- ARTICLE CARD ---- */
.gazetka-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.15s;
    cursor: pointer;
}
.gazetka-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.gazetka-card-pinned {
    border-left: 4px solid #e74c3c;
}

.gazetka-card-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.gazetka-card-body {
    padding: 16px;
}

.gazetka-card-category {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.gazetka-cat-news { background: #e8f8f5; color: #1abc9c; }
.gazetka-cat-gallery { background: #fef5e7; color: #f39c12; }
.gazetka-cat-video { background: #ebf5fb; color: #3498db; }
.gazetka-cat-event { background: #f4ecf7; color: #8e44ad; }
.gazetka-cat-creative { background: #fdedec; color: #e74c3c; }
.gazetka-cat-interview { background: #eafaf1; color: #27ae60; }
.gazetka-cat-poll { background: #ebedef; color: #34495e; }

.gazetka-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.gazetka-card-excerpt {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gazetka-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #999;
}

.gazetka-card-authors {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #555;
    font-weight: 500;
}

.gazetka-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gazetka-card-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.gazetka-visibility-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 8px;
    background: #eee;
    color: #888;
    margin-left: 6px;
}

/* ---- SIDEBAR ---- */
.gazetka-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.gazetka-sidebar-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}
.gazetka-sidebar-section h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 8px;
}

.gazetka-team-member {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.9rem;
}
.gazetka-team-member:last-child {
    border-bottom: none;
}

.gazetka-team-badge {
    font-size: 1.1rem;
}
.gazetka-team-badge.chief {
    font-size: 1.3rem;
}

.gazetka-team-role {
    margin-left: auto;
    font-size: 0.75rem;
    color: #999;
}

.gazetka-muted {
    color: #999;
    font-size: 0.85rem;
}

/* ---- MODAL ---- */
.gazetka-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
}

.gazetka-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.gazetka-modal-wide {
    max-width: 800px;
}

.gazetka-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #999;
    cursor: pointer;
    z-index: 2;
    line-height: 1;
}
.gazetka-modal-close:hover {
    color: #e74c3c;
}

.gazetka-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}
.gazetka-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

/* ---- ARTICLE FULL VIEW ---- */
.gazetka-article-full {
    padding: 32px;
}
.gazetka-article-full h1 {
    font-size: 1.6rem;
    color: #2c3e50;
    margin: 0 0 8px 0;
    line-height: 1.3;
}
.gazetka-article-full .gazetka-article-meta {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}
.gazetka-article-full .gazetka-article-content {
    color: #333;
    font-size: 1rem;
    line-height: 1.7;
}
.gazetka-article-full .gazetka-article-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 12px 0;
}
.gazetka-article-authors-block {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 0;
    margin-top: 20px;
    border-top: 1px solid #eee;
}
.gazetka-author-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: #ecf0f1;
    border-radius: 16px;
    font-size: 0.85rem;
    color: #2c3e50;
}

/* ---- EDITOR FORM ---- */
.gazetka-editor-form {
    padding: 24px;
}
.gazetka-editor-form .form-group {
    margin-bottom: 16px;
}
.gazetka-editor-form label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    font-size: 0.9rem;
}
.gazetka-editor-form input[type="text"],
.gazetka-editor-form textarea,
.gazetka-editor-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #333;
    box-sizing: border-box;
}
.gazetka-editor-form textarea {
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}
.gazetka-editor-form .form-row {
    display: flex;
    gap: 12px;
}
.gazetka-editor-form .form-row .form-group {
    flex: 1;
}
.gazetka-editor-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid #eee;
}
.gazetka-btn-secondary {
    background: #ecf0f1;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
.gazetka-btn-danger {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* ---- GALLERY GRID ---- */
.gazetka-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    margin: 12px 0;
}
.gazetka-gallery-grid img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.15s;
}
.gazetka-gallery-grid img:hover {
    transform: scale(1.03);
}

/* ---- LIGHTBOX ---- */
.gazetka-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}
.gazetka-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

/* ---- YOUTUBE EMBED ---- */
.gazetka-yt-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    margin: 12px 0;
}
.gazetka-yt-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ---- REACTIONS & COMMENTS ---- */
.gazetka-reactions-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 0;
    flex-wrap: wrap;
}
.gazetka-reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #eee;
    border-radius: 16px;
    background: #fafafa;
    cursor: pointer;
    font-size: 0.85rem;
    color: #555;
    transition: background 0.15s;
}
.gazetka-reaction-btn:hover {
    background: #ecf0f1;
}
.gazetka-reaction-btn.active {
    background: #ebf5fb;
    border-color: #3498db;
    color: #3498db;
}

.gazetka-comments-section {
    border-top: 1px solid #eee;
    padding-top: 16px;
    margin-top: 12px;
}
.gazetka-comment {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
}
.gazetka-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.gazetka-comment-body {
    flex: 1;
}
.gazetka-comment-author {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85rem;
}
.gazetka-comment-text {
    color: #555;
    font-size: 0.9rem;
    margin-top: 2px;
}
.gazetka-comment-time {
    color: #bbb;
    font-size: 0.75rem;
}

.gazetka-comment-form {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.gazetka-comment-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #333;
}
.gazetka-comment-form button {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* ---- POLL ---- */
.gazetka-poll {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
}
.gazetka-poll h4 {
    margin: 0 0 12px 0;
    color: #333;
}
.gazetka-poll-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.gazetka-poll-option:hover {
    background: #ecf0f1;
}
.gazetka-poll-option.voted {
    border-color: #3498db;
    background: #ebf5fb;
}
.gazetka-poll-bar {
    height: 6px;
    background: #3498db;
    border-radius: 3px;
    transition: width 0.4s;
}
.gazetka-poll-bar-bg {
    flex: 1;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

/* ---- STATS (edytor view) ---- */
.gazetka-stat-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
}
.gazetka-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
}
.gazetka-stat-label {
    color: #999;
    font-size: 0.8rem;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .gazetka-main {
        flex-direction: column;
        padding: 12px;
    }
    .gazetka-sidebar {
        width: 100%;
        order: -1;
    }
    .gazetka-header {
        padding: 12px 16px;
    }
    .gazetka-title {
        font-size: 1.1rem;
    }
    .gazetka-categories {
        padding: 8px 12px;
    }
    .gazetka-card-cover {
        height: 150px;
    }
    .gazetka-article-full {
        padding: 20px;
    }
    .gazetka-modal-content {
        margin-top: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    .gazetka-modal {
        padding: 0;
    }
}

/* ============================================================================
   MOBILE PORTRAIT (KM-MOBILE-HUB krok 5)
   Header kompaktowy, kategorie scrollowane sticky, sidebar zwiniety,
   modal artykulu pelnoekranowy z duzym touch X.
   ============================================================================ */
@media (max-width: 768px) and (orientation: portrait) {
    /* Header — flex-wrap, kompaktowy */
    .gazetka-header {
        flex-wrap: wrap;
        gap: 8px !important;
        padding: 8px 10px !important;
    }

    .gazetka-header-left {
        gap: 6px !important;
    }

    .gazetka-back-btn {
        padding: 7px 10px !important;
        font-size: 0.8rem !important;
    }

    .gazetka-title {
        font-size: 1rem !important;
    }

    .gazetka-header-right {
        flex-basis: 100%;
        justify-content: stretch;
        gap: 6px !important;
    }

    .gazetka-btn-primary,
    .gazetka-btn-secondary {
        flex: 1;
        padding: 8px 8px !important;
        font-size: 0.78rem !important;
        white-space: nowrap;
    }

    /* Kategorie — scrollowane poziomo, sticky pod headerem */
    .gazetka-categories {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 8px !important;
        gap: 6px !important;
        position: sticky;
        top: 0;
        z-index: 50;
        background: #fff;
        border-bottom: 1px solid #e0e0e0;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
    }

    .gazetka-categories::-webkit-scrollbar {
        display: none;
    }

    .gazetka-cat-btn {
        flex-shrink: 0 !important;
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
        white-space: nowrap !important;
    }

    /* Sidebar zwiniety nad lista (juz order: -1) — kompaktowy */
    .gazetka-sidebar-section {
        padding: 12px !important;
        margin-bottom: 10px !important;
    }

    .gazetka-sidebar-section h3 {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    .gazetka-team-member {
        font-size: 0.85rem;
        padding: 4px 0;
    }

    /* Karty artykulow */
    .gazetka-card {
        margin-bottom: 14px;
        border-radius: 12px;
    }

    .gazetka-card-body {
        padding: 12px;
    }

    .gazetka-card-title {
        font-size: 1.05rem;
    }

    .gazetka-card-excerpt {
        font-size: 0.88rem;
        -webkit-line-clamp: 2;
    }

    .gazetka-card-footer {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 0.75rem;
    }

    /* Modal — wieksze X, pelny ekran */
    .gazetka-modal-close {
        width: 44px;
        height: 44px;
        font-size: 2rem;
        top: 8px;
        right: 8px;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 50%;
        line-height: 1;
        z-index: 10;
    }

    .gazetka-modal-header {
        padding: 12px 16px !important;
    }

    .gazetka-modal-header h2 {
        font-size: 1.1rem !important;
    }

    /* Pelny artykul — czytelny */
    .gazetka-article-full {
        padding: 14px !important;
    }

    /* iOS prevent zoom on input */
    .gazetka-modal input,
    .gazetka-modal textarea,
    .gazetka-modal select {
        font-size: 16px !important;
    }
}
