/* ==========================================================================
   STYLE TPS 53 SZCZECIN
   ========================================================================== */

:root {
    --primary: #0f2b5c;
    --primary-light: #1b437e;
    --primary-dark: #0a1c3d;
    --accent: #d97706;
    --accent-gold: #f59e0b;
    --accent-light: #fef3c7;
    --bg-light: #f8fafc;
    --text-dark: #0f172a;
    --text-muted: #475569;
    --border-color: #cbd5e1;
    --white: #ffffff;
    --radius: 8px;
    --shadow: 0 4px 12px rgba(15, 43, 92, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    position: relative;
    isolation: isolate;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url("../images/logo_tps.jpeg") center / min(100vw, 1200px) auto no-repeat;
    opacity: 0.08;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Nawigacja */
.navbar {
    background: var(--white);
    box-shadow: 0 2px 8px rgba(15, 43, 92, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}

.logo-img {
    height: 45px;
    max-height: 45px;
    width: auto;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.nav-menu {
    display: flex;
    gap: 10px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background-color: #f1f5f9;
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}

.main-content {
    padding-top: 30px;
    padding-bottom: 60px;
    min-height: 75vh;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* NOWOŚĆ: Układ Flex powiększonego logo wyrównanego wysokością do kontenera banneru */
.hero-wrapper {
    display: flex;
    gap: 20px;
    align-items: stretch;
    /* Wyrównanie wysokości obydwu kontenerów */
    margin-bottom: 30px;
}

.hero-banner {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 30px 35px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: var(--shadow);
    border-left: 6px solid var(--accent-gold);
}

.hero-text h2 {
    font-size: 1.7rem;
    margin-bottom: 8px;
}

.hero-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin-top: 15px;
    width: fit-content;
}

.hero-logo-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 15px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 220px;
}

.hero-logo-img {
    max-height: 140px;
    width: auto;
    object-fit: contain;
}

@media (max-width: 850px) {
    .hero-wrapper {
        flex-direction: column;
    }

    .hero-logo-card {
        min-width: 100%;
        padding: 20px;
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 250px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.tag {
    padding: 6px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.tag.active,
.tag:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Kafelki aktualności ze zdjęciem głównym okładkowym */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.news-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.news-card:hover {
    transform: translateY(-4px);
}

.news-cover-wrapper {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
    background: #f1f5f9;
    cursor: pointer;
}

.news-cover-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    cursor: default;
}

.news-cover-placeholder i {
    font-size: 3rem;
}

.news-cover-placeholder span {
    font-size: 0.9rem;
    font-weight: 600;
}

.news-cover-placeholder.category-wydarzenia {
    background: linear-gradient(135deg, #0f766e, #2dd4bf);
}

.news-cover-placeholder.category-ogloszenia {
    background: linear-gradient(135deg, #1d4ed8, #60a5fa);
}

.news-cover-placeholder.category-projekty {
    background: linear-gradient(135deg, #7e22ce, #c084fc);
}

.news-cover-placeholder.category-rada {
    background: linear-gradient(135deg, #b45309, #fbbf24);
}

.news-cover-placeholder.category-oplaty {
    background: linear-gradient(135deg, #047857, #34d399);
}

.news-cover-placeholder.category-default {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

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

.news-cover-wrapper:hover .news-cover-img {
    transform: scale(1.05);
}

.news-card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 14px 20px 0;
}

.category-badge {
    background: #e0f2fe;
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.category-badge.rr {
    background: #fef3c7;
    color: #78350f;
}

.news-title {
    font-size: 1.15rem;
    margin-bottom: 10px;
    color: var(--primary);
    line-height: 1.35;
    min-height: 2.7em;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.news-excerpt {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 20px;
    flex-grow: 1;
    line-height: 1.5;
    min-height: 4.5em;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.page-header {
    margin-bottom: 30px;
}

.card-stack {
    display: grid;
    gap: 25px;
    align-content: start;
}

.card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.shadow {
    box-shadow: var(--shadow);
}

.card-header {
    padding: 15px 20px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border-color);
}

.bg-primary {
    background: var(--primary);
    color: white;
}

.bg-gold {
    background: var(--accent-gold);
    color: #451a03;
}

.bg-dark {
    background: var(--primary-dark);
    color: white;
}

.card-body {
    padding: 20px;
}

.member-list,
.board-list {
    list-style: none;
}

.member-list li,
.board-list li {
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-color);
    display: flex;
    justify-content: space-between;
}

.member-role {
    font-weight: 600;
    color: var(--primary);
}

.bank-box {
    background: var(--accent-light);
    border: 1px solid #fde68a;
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 15px;
}

.account-number {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 10px;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    margin: 8px 0;
    font-family: monospace;
    font-size: 1rem;
}

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

.info-table th,
.info-table td {
    padding: 10px 5px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.info-table th {
    color: var(--text-muted);
    width: 35%;
}

.governance-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.governance-section h5 {
    margin-bottom: 8px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-light {
    background: #e2e8f0;
    color: #1e293b;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

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

.btn-success {
    background: #059669;
    color: white;
}

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

.docs-table th,
.docs-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.docs-table th {
    background: #f8fafc;
    color: var(--text-muted);
}

/* Modale */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

#modal-image-lightbox {
    z-index: 1100;
}

.modal-content {
    background: white;
    max-width: 650px;
    margin: 40px auto;
    border-radius: var(--radius);
    padding: 30px;
    position: relative;
}

.modal-lg {
    max-width: 900px;
}

.modal-sm {
    max-width: 400px;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-muted);
    z-index: 10;
}

.cms-modal-close {
    top: 12px;
    right: 20px;
}

.modal-img-content {
    max-width: 850px;
    background: #0f172a;
    color: white;
    text-align: center;
    padding: 20px;
    padding-bottom: 48px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary);
    cursor: pointer;
    transform: translateY(-50%);
}

.lightbox-nav:hover {
    background: white;
}

.lightbox-prev {
    left: 28px;
}

.lightbox-next {
    right: 28px;
}

.lightbox-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    color: #cbd5e1;
}

.article-body {
    margin-top: 2em;
    line-height: 1.8;
}

.article-body blockquote {
    margin: 1em 0;
    padding: 10px 16px;
    border-left: 4px solid var(--accent-gold);
    background: #f8fafc;
    color: var(--text-muted);
}

.article-body ul,
.article-body ol {
    padding-left: 1.5em;
}

.lightbox-img-full {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 4px;
    object-fit: contain;
}

.footer {
    background: var(--primary-dark);
    color: #94a3b8;
    padding-top: 40px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 30px;
    padding-bottom: 30px;
}

.footer-col h5 {
    color: white;
    margin-bottom: 15px;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col a {
    color: #94a3b8;
    text-decoration: none;
}

.footer-bottom {
    border-top: 1px solid #1e293b;
    padding: 18px 0;
}

.footer-bottom-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.85rem;
}

.btn-cms-footer {
    display: inline-block;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
    padding: 6px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-cms-footer:hover {
    background-color: var(--accent-gold);
    color: var(--primary-dark);
    border-color: var(--accent-gold);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.editor-toolbar .btn {
    min-width: 34px;
    padding: 6px 8px;
}

.rich-text-editor {
    min-height: 220px;
    overflow-y: auto;
    line-height: 1.6;
    white-space: pre-wrap;
    cursor: text;
}

.rich-text-editor:focus {
    outline: 2px solid rgba(15, 43, 92, 0.2);
    border-color: var(--primary);
}

.rich-text-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    opacity: 0.7;
    pointer-events: none;
}

.rich-text-editor blockquote {
    margin: 8px 0;
    padding-left: 12px;
    border-left: 3px solid var(--accent-gold);
    color: var(--text-muted);
}

.emoji-picker {
    position: relative;
}

.emoji-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 5;
    width: min(390px, calc(100vw - 40px));
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
    box-shadow: var(--shadow);
    color: var(--text-dark);
}

.emoji-picker-menu[hidden] {
    display: none;
}

.emoji-picker-menu .emoji-category {
    border: 0;
    border-radius: 4px;
    background: #f1f5f9;
    padding: 5px 8px;
    font-size: 0.75rem;
    cursor: pointer;
}

.emoji-picker-menu .emoji-category.active {
    background: var(--primary);
    color: white;
}

.emoji-category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 8px 0;
}

.emoji-count {
    margin: 5px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.emoji-attribution {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 3px;
    max-height: 230px;
    overflow-y: auto;
}

.emoji-picker-menu .emoji-option {
    border: 0;
    border-radius: 4px;
    background: transparent;
    padding: 4px;
    font-size: 1.2rem;
    cursor: pointer;
}

.emoji-image {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
}

.emoji-picker-menu .emoji-option .emoji-image {
    width: 1.35rem;
    height: 1.35rem;
    vertical-align: middle;
}

.rich-text-editor .emoji-editor-image {
    width: 1.25em;
    height: 1.25em;
}

.emoji-picker-menu button:hover {
    background: #f1f5f9;
}

@media (max-width: 600px) {
    .emoji-picker-menu {
        left: auto;
        right: 0;
    }
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.media-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    font-size: 0.75rem;
    word-break: break-all;
}

.media-item img {
    width: 100%;
    height: 85px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 5px;
}

.media-preview {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

.image-picker-item {
    display: block;
    cursor: pointer;
}

.image-picker-item input {
    margin-right: 5px;
}

.image-picker-item img {
    display: block;
}

.image-actions {
    margin: 10px 0;
}

.media-delete {
    margin-top: 8px;
}

.text-danger {
    color: #dc2626;
}

.cms-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    padding-right: 45px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.cms-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.cms-tab-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
}

.cms-tab-btn.active {
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
}

.cms-tab-pane {
    display: none;
}

.cms-tab-pane.active {
    display: block;
}

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

.cms-table th,
.cms-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.user-create-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 16px;
    align-items: end;
    margin: 16px 0 28px;
}

.user-create-form .btn {
    margin-bottom: 15px;
    justify-self: start;
}

.user-actions {
    white-space: nowrap;
}

.user-actions .btn {
    margin: 2px;
}

.user-actions .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.trash-actions {
    white-space: nowrap;
}

.trash-actions .btn {
    margin: 2px;
}

.text-gold {
    color: var(--accent-gold);
}