html, body {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
}
body {
    overflow-x: hidden;
}
body {
    margin: 0;
    padding: 20px 5vw;
    box-sizing: border-box;
}
.titleNew {
    font-family: 'Catalog OCR-A', monospace;
    font-weight: normal;
    letter-spacing: 1px;
}
@font-face {
    font-family: 'Catalog OCR-A';
    font-style: normal;
    font-weight: normal;
    src: url('https://zabytki.archeologpwl.com/OCR-a___.woff') format('woff');
    font-display: swap;
}
.catalog-header .detail-brand .titleNew {
    font-family: 'Catalog OCR-A', monospace;
    font-weight: normal;
}
.brand-first-letter,
.brand-first-letter-sm {
    color: #ffc107;
    font-size: 1.3em;
}
.navbar-brand {
    transition: transform 0.3s ease;
}
.navbar-brand:hover {
    transform: scale(1.05);
}
.container {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    position: 'fixed';
    top: '0';
    left: '0';
    width: '100%';
    zIndex: '1000';
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.header-content {
    flex: 1;
}

.header img {
    height: 60px;
    filter: brightness(0) invert(1);
}

.controls {
    background: white;
    padding: 20px;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sort-control {
    background: #f8f9ff;
    border: 1px solid #e1e4f2;
    border-radius: 8px;
    padding: 12px;
}

.sort-control label {
    font-weight: 600;
    font-size: 13px;
    color: #444;
    display: block;
    margin-bottom: 6px;
}

.sort-row {
    display: flex;
    gap: 8px;
}

.sort-row select {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #d0d4e4;
    border-radius: 6px;
    background: white;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-bar input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.filter-group select,
.filter-group input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #eee;
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.stats-item strong {
    color: #667eea;
    font-size: 18px;
}

.export-panel {
    display: none;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: #fff;
    padding: 14px;
    margin: 14px 0 6px;
    border-radius: 10px;
    border: 1px solid #e1e4f2;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

.export-title {
    font-weight: 700;
    color: #333;
}

.export-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.export-buttons button {
    border: none;
    border-radius: 6px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    color: white;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.export-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.btn-export-csv { background: #009688; }
.btn-export-xlsx { background: #4caf50; }
.btn-export-pdf { background: #e53935; }
.btn-export-disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }

.table-container {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: visible;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    min-width: 100%;
    max-width: 100%;
}

table {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
}

thead {
    background: #667eea;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th:hover {
    background: #5568d3;
}

th.sortable::after {
    content: ' ⇅';
    opacity: 0.5;
}

th.sort-asc::after {
    content: ' ▲';
    opacity: 1;
}

th.sort-desc::after {
    content: ' ▼';
    opacity: 1;
}

tbody tr {
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8f9ff;
}

td {
    padding: 12px 10px;
    font-size: 14px;
}

.id-cell {
    position: relative;
    font-weight: 600;
    color: #667eea;
}

.id-photo-count {
    position: absolute;
    top: 50%;
    right: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 3px;
    border-radius: 8px;
    color: #168bd2;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    transform: translateY(-50%);
}

.id-photo-count i {
    color: #8bcaff;
    font-size: 11px;
}

@media (min-width: 768px) {
    .id-cell {
        white-space: nowrap;
    }

    .id-photo-count {
        position: static;
        margin-left: 8px;
        transform: none;
        vertical-align: middle;
    }
}

.id-cell a {
    color: #667eea;
    text-decoration: none;
}

.id-cell a:hover {
    text-decoration: underline;
}

.type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.type-wydzielony {
    background: #e3f2fd;
    color: #1976d2;
}

.type-masowy {
    background: #fff3e0;
    color: #f57c00;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #667eea;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    font-size: 14px;
    color: #666;
}

.quick-contact {
    position: fixed;
    right: 20px;
    top: 35%;
    transform: translateY(-50%);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(0,0,0,0.2);
    position: relative;
    overflow: visible;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quick-contact-btn:hover,
.quick-contact-btn:focus {
    transform: translateX(-2px);
    box-shadow: 0 10px 22px rgba(0,0,0,0.24);
    color: #fff;
}

.quick-contact-btn i {
    font-size: 18px;
}

.quick-contact-label {
    position: absolute;
    right: 56px;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: rgba(33, 37, 41, 0.95);
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.quick-contact-btn:hover .quick-contact-label,
.quick-contact-btn:focus .quick-contact-label,
.quick-contact-btn.contact-open .quick-contact-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.quick-contact-phone { background: #f57c00; }
.quick-contact-mail { background: #1e88e5; }
.quick-contact-fb { background: #1877f2; }

/* Admin panel styles */
.admin-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #f57c00;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(245, 124, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s;
}

.admin-btn:hover {
    background: #e65100;
    transform: scale(1.05);
}

.admin-btn.logged-in {
    background: #4caf50;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #ddd;
    color: #333;
}

.btn-secondary:hover {
    background: #ccc;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

@media (max-width: 768px) {
    .quick-contact {
        top: auto;
        bottom: 84px;
        right: 14px;
        transform: none;
        gap: 6px;
    }

    .quick-contact-btn {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }

    .quick-contact-label {
        right: 52px;
        font-size: 12px;
    }
}


:root {
    --catalog-navy: #22395d;
    --catalog-blue: #009cff;
    --catalog-pale: #f3f6ff;
    --catalog-ink: #28384c;
}

body {
    padding: 24px;
    background: var(--catalog-pale);
    color: var(--catalog-ink);
    font-family: 'Montserrat', sans-serif;
}

.container {
    width: 100%;
    min-width: 0;
    max-width: 1440px;
    padding: 0;
}

.header.catalog-header {
    position: relative;
    inset: auto;
    z-index: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    margin: 0 auto 24px;
    padding: 22px 28px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    background: linear-gradient(115deg, #22395d 0%, #125b8e 100%);
    text-align: left;
    box-shadow: 0 8px 24px rgba(34, 57, 93, 0.16);
}

.catalog-header .header-content {
    min-width: 0;
    text-align: center;
}

.catalog-header .detail-brand-mark {
    width: 38px;
    height: 38px;
    filter: none;
}

.catalog-header h1 {
    margin: 0 0 6px;
    color: #fff;
    font-family: 'Roboto', sans-serif;
    font-size: 30px;
    font-weight: 700;
}

.catalog-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
}

.catalog-home-link {
    flex: 0 0 auto;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 5px;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.catalog-home-link:hover,
.catalog-home-link:focus {
    background: #fff;
    color: var(--catalog-navy);
    text-decoration: none;
}

.controls,
.table-container,
.pagination {
    width: 100%;
    min-width: 0;
    max-width: none;
    border: 1px solid #dce4ef;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(34, 57, 93, 0.06);
}

.controls {
    margin-bottom: 18px;
    background: #fff;
}

.sort-control {
    border-color: #dce4ef;
    border-radius: 5px;
    background: #f8faff;
}

.search-bar input:focus,
.filter-group select:focus,
.filter-group input:focus,
.form-group input:focus {
    border-color: var(--catalog-blue);
    box-shadow: 0 0 0 3px rgba(0, 156, 255, 0.12);
}

.sort-control label,
.filter-group label {
    color: var(--catalog-navy);
}

.pagination button:hover:not(:disabled),
.btn-primary {
    background: var(--catalog-blue);
}

.pagination button:hover:not(:disabled),
.btn-primary:hover {
    background: #007bc5;
}

.admin-btn {
    background: var(--catalog-navy);
}

.admin-btn:hover {
    background: #125b8e;
}

thead {
    background: var(--catalog-navy);
}

th:hover {
    background: #125b8e;
}

.id-cell,
.id-cell a,
.stats-item strong,
.loading {
    color: var(--catalog-blue);
}

.type-wydzielony {
    background: #e7f4ff;
    color: #145b88;
}

.type-masowy {
    background: #fff3d8;
    color: #7c5411;
}

.table-container {
    background: #fff;
}

.pagination {
    margin-top: 16px;
    background: #fff;
}

.modal-content {
    border: 1px solid #dce4ef;
    border-radius: 6px;
}

.modal-header h2 {
    color: var(--catalog-navy);
}

.admin-btn {
    border-radius: 5px;
}

@media (max-width: 767.98px) {
    body {
        padding: 14px;
    }

    .header.catalog-header {
        flex-wrap: wrap;
        justify-content: center;
        gap: 14px 18px;
        padding: 18px;
    }

    .catalog-header .header-content {
        flex: 1 0 100%;
        order: 2;
    }

    .catalog-header h1 {
        font-size: 24px;
    }

    .catalog-header .catalog-home-link {
        order: 3;
    }

    .catalog-header .detail-brand {
        margin: 0 auto;
    }
}

.controls {
    padding: 12px;
}

.filter-section,
.sort-panel {
    min-width: 0;
}

.filter-section {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
}

.control-section-heading {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    margin: 0;
}

.filter-section > .control-section-heading {
    grid-column: span 2;
}

.control-section-heading h2 {
    margin: 0;
    color: var(--catalog-navy);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.control-section-heading h2 i {
    margin-right: 2px;
    color: var(--catalog-blue);
    font-size: 11px;
}

.control-reset-button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--catalog-blue);
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.control-reset-button:hover {
    transform: rotate(-20deg);
}

.control-reset-button.reset-filters {
    background: #168bd2;
}

.control-reset-button.reset-filters:hover {
    background: #007bc5;
}

.filter-section > .search-bar {
    grid-column: span 2;
    min-width: 0;
    margin: 0;
}

.filter-section > .filters {
    display: contents;
}

.filter-section .filter-group {
    min-width: 0;
    gap: 3px;
}

.filter-section .filter-group label {
    overflow: hidden;
    font-size: 11px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-section .search-bar input,
.filter-section .filter-group select,
.filter-section .filter-group input {
    width: 100%;
    min-width: 0;
    height: 32px;
    min-height: 32px;
    padding: 4px 7px;
    border: 1px solid #d0dbe8;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
}

.catalog-summary {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px 18px;
    margin: 8px 0;
    padding: 7px 2px;
    border-top: 1px solid #e5ebf2;
    border-bottom: 1px solid #e5ebf2;
}

.catalog-summary .stats-item {
    gap: 6px;
    font-size: 12px;
}

.catalog-summary .stats-item label {
    margin: 0;
    cursor: pointer;
}

.catalog-summary .stats-item strong {
    font-size: 14px;
}

.catalog-summary input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--catalog-blue);
}

.advanced-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.sort-panel {
    display: block;
}

.sort-options {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 1.5rem !important;
    align-items: flex-end !important;
}

.sort-control {
    display: block;
    flex: 1 1 0 !important;
    min-width: 0;
    width: auto !important;
}

.sort-control label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
}

.sort-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem !important;
    align-items: center !important;
}

.sort-row select {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: 100%;
    min-height: 28px;
    padding: 3px 5px;
    font-size: 12px;
}

.advanced-tools .export-panel {
    margin: 0;
}

@media (max-width: 1100px) {
    .filter-section > .control-section-heading,
    .filter-section > .search-bar {
        grid-column: span 2;
    }
}

@media (max-width: 767.98px) {
    .filter-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-section > .search-bar {
        grid-column: 1 / -1;
    }

    .filter-section > .control-section-heading {
        grid-column: 1 / -1;
    }

    .sort-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .sort-options {
        flex-direction: column !important;
    }

    .sort-control {
        width: 100% !important;
    }
}

@media (max-width: 520px) {
    .controls {
        padding: 9px;
    }

    .filter-section {
        grid-template-columns: minmax(0, 1fr);
    }

    .filter-section > .search-bar {
        grid-column: 1;
    }

    .sort-row select {
        flex-basis: 0;
    }

    .catalog-summary {
        gap: 6px 12px;
    }
}

.catalog-side-actions {
    position: fixed;
    top: 50%;
    left: 14px;
    z-index: 1101;
    display: grid;
    grid-template-columns: repeat(2, 42px);
    gap: 8px;
    transform: translateY(-50%);
}

.catalog-side-actions .multi-image-button {
    position: static;
    display: none;
    width: 42px;
    height: 42px;
    transform: none;
}

.catalog-side-actions .multi-image-button.active {
    display: inline-flex;
}

.catalog-side-actions #catalogControlsToggle {
    background: #168bd2;
}

.catalog-side-actions #catalogControlsToggle:hover,
.catalog-side-actions #catalogControlsToggle:focus-visible {
    background: #007bc5;
}

.controls.is-collapsed {
    display: none;
}

@media (max-width: 768px) {
    .catalog-side-actions {
        top: auto;
        bottom: 24px;
        left: 12px;
        transform: none;
    }
}
