/* Publiskas dokumentu lapas izkartojums un filtri. */

/* ===== DOKUMENTU LAPA ===== */
.dokumenti-page {
    padding: 40px 0;
    background-color: #f8f9fa;
    min-height: 100%;
}

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

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: #520505;
    margin-bottom: 2rem;
    text-align: left;
    border-bottom: 3px solid #ffcc00;
    padding-bottom: 10px;
    display: inline-block;
}

/* Tabulas konteiners - ar noapaļotiem stūriem */
.dokumenti-tabula {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    width: 100%;
}

.dokumenti-view-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    margin-left: auto;
    padding: 6px;
    width: fit-content;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(82, 5, 5, 0.16);
    box-shadow: 0 8px 20px rgba(82, 5, 5, 0.08);
}

.view-switch-btn {
    border: 0;
    border-radius: 9px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #520505;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-switch-btn:hover {
    background: rgba(82, 5, 5, 0.08);
}

.view-switch-btn.is-active {
    background: #520505;
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(82, 5, 5, 0.2);
}

.dokumenti-cards-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.dokumenta-card {
    background: #ffffff;
    border: 1px solid rgba(82, 5, 5, 0.12);
    border-radius: 14px;
    padding: 18px 16px;
    box-shadow: 0 10px 24px rgba(24, 18, 18, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 250px;
}

.dokumenta-card-icon.dokumenta-tipa-ikona {
    width: auto;
    height: auto;
    border-radius: 0;
    font-size: 2.8rem;
    margin-bottom: 14px;
    background: transparent !important;
    box-shadow: none;
}

.dokumenta-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #520505;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}

.dokumenta-card-size {
    margin: 6px 0 14px;
    font-size: 0.9rem;
    color: #6b6b6b;
}

.dokumenta-card-download {
    margin-top: auto;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #520505;
    background: #520505;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.dokumenta-card-download:hover {
    background: #7a0f0f;
    border-color: #7a0f0f;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(82, 5, 5, 0.2);
    color: #ffffff;
}

.dokumenta-card-download.is-disabled {
    background: #e8e8e8;
    border-color: #dadada;
    color: #757575;
    cursor: not-allowed;
}

.dokumenta-card-empty {
    grid-column: 1 / -1;
    background: #ffffff;
    border: 1px dashed rgba(82, 5, 5, 0.25);
    border-radius: 12px;
    padding: 28px;
    text-align: center;
    color: #520505;
    font-weight: 600;
}

.tabula {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    border: none;
}

.tabula th {
    background: #520505;
    color: white;
    font-weight: 600;
    padding: 12px 15px;
    text-align: left;
    white-space: nowrap;
}

/* Pirmajam th noapaļots kreisais augšējais stūris */
.tabula th:first-child {
    border-top-left-radius: 12px;
    padding-left: 20px;
}

/* Pēdējam th noapaļots labais augšējais stūris */
.tabula th:last-child {
    border-top-right-radius: 12px;
    padding-right: 20px;
}

.tabula td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
}

/* Pirmās kolonnas šūnām kreisais padding */
.tabula td:first-child {
    padding-left: 20px;
}

/* Pēdējās kolonnas šūnām labais padding */
.tabula td:last-child {
    padding-right: 20px;
}

/* Pēdējās rindas šūnas ar noapaļotiem apakšējiem stūriem */
.tabula tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.tabula tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

.tabula tr:last-child td {
    border-bottom: none;
}

.tabula tr:hover td {
    background-color: #f9f9f9;
}

/* Kolonnu platuma sadalījums */
.tabula th:nth-child(1) { width: 30%; }  /* Datne */
.tabula th:nth-child(2) { width: 12%; }  /* Pievienošanas datums */
.tabula th:nth-child(3) { width: 10%; }  /* Izmērs */
.tabula th:nth-child(4) { width: 20%; }  /* Kategorija */
.tabula th:nth-child(5) { width: 8%; }   /* Lejupielādēt */

/* Satura apstrāde */
.tabula td:nth-child(1) {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

.dokumenta-nosaukums-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dokumenta-tipa-ikona {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    font-size: 1.1rem;
    background: rgba(82, 5, 5, 0.1);
    color: #520505;
}

.dokumenta-tipa-ikona.file-type-pdf {
    background: rgba(208, 41, 41, 0.14);
    color: #a51414;
}

.dokumenta-tipa-ikona.file-type-word {
    background: rgba(30, 100, 200, 0.14);
    color: #1e64c8;
}

.dokumenta-tipa-ikona.file-type-excel {
    background: rgba(32, 132, 78, 0.14);
    color: #1f7f4e;
}

.dokumenta-tipa-ikona.file-type-powerpoint {
    background: rgba(218, 112, 30, 0.14);
    color: #b55a13;
}

.dokumenta-tipa-ikona.file-type-image {
    background: rgba(126, 82, 201, 0.14);
    color: #6d45b4;
}

.dokumenta-tipa-ikona.file-type-archive {
    background: rgba(157, 116, 53, 0.14);
    color: #8d6830;
}

.dokumenta-tipa-ikona.file-type-text {
    background: rgba(87, 104, 126, 0.14);
    color: #50627a;
}

.dokumenta-nosaukums-teksts {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tabula td:nth-child(4) {
    text-align: left;
}

/* Lejupielādes poga – ikona */
.btn-lejupielade-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: #520505;
    color: white;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-lejupielade-icon:hover {
    background-color: #7a0f0f;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(82,5,5,0.2);
}

.btn-lejupielade-icon i {
    font-size: 1rem;
}

/* ===== VIENKĀRŠĀ LAPOŠANA ===== */
.pagination-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding: 10px 0;
}

.pagination-link {
    display: inline-block;
    padding: 10px 20px;
    background-color: #520505;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #520505;
}

.pagination-link:hover {
    background-color: #7a0f0f;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(82,5,5,0.2);
}

.pagination-link.disabled {
    background-color: #ccc;
    border-color: #ccc;
    color: #666;
    pointer-events: none;
    cursor: default;
    opacity: 0.6;
}

/* ===== FILTRĒŠANAS STILI ===== */
.filters-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid rgba(82,5,5,0.1);
    overflow: visible;
}

.filters-form {
    width: 100%;
    overflow: visible;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    overflow: visible;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #520505;
    margin-bottom: 5px;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
}

.custom-select {
    position: relative;
}

.custom-select-trigger {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #fcf6f1 100%);
    color: #520505;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 8px 18px rgba(82, 5, 5, 0.08);
}

.custom-select-trigger:hover {
    border-color: rgba(82, 5, 5, 0.32);
    box-shadow: 0 12px 24px rgba(82, 5, 5, 0.12);
}

.custom-select-trigger:focus {
    outline: none;
    border-color: #520505;
    box-shadow: 0 0 0 3px rgba(82,5,5,0.1);
}

.custom-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(82, 5, 5, 0.08);
    color: #520505;
    transition: transform 0.25s ease, background-color 0.25s ease;
}

.custom-select.is-open .custom-select-icon {
    transform: rotate(180deg);
    background: rgba(82, 5, 5, 0.14);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 35;
    display: none;
    padding: 8px;
    border: 1px solid rgba(82, 5, 5, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 45px rgba(24, 18, 18, 0.18);
    backdrop-filter: blur(10px);
}

.custom-select.is-open .custom-select-dropdown {
    display: block;
}

.custom-select-option {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 12px 14px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #520505;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.custom-select-option:hover,
.custom-select-option:focus {
    outline: none;
    background: linear-gradient(135deg, rgba(82, 5, 5, 0.08), rgba(255, 204, 0, 0.12));
    transform: translateX(2px);
}

.custom-select-option.is-selected {
    background: linear-gradient(135deg, #520505 0%, #7a0f0f 100%);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(82, 5, 5, 0.18);
}

.custom-select-option-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

.custom-select-option-meta {
    font-size: 0.78rem;
    opacity: 0.72;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #520505;
    box-shadow: 0 0 0 3px rgba(82,5,5,0.1);
}

.filter-select option {
    background-color: #ffffff;
    color: #520505;
    padding: 10px 12px;
}

.filter-select option:checked,
.filter-select option:hover {
    background-color: #520505;
    color: #ffffff;
}

.filter-input::placeholder {
    color: #aaa;
    font-size: 0.9rem;
}

.dokumenti-date-input-wrapper {
    width: 100%;
}

.dokumenti-date-group {
    position: relative;
}

.dokumenti-calendar-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 30;
    margin-top: 6px;
    width: max-content;
    min-width: 300px;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
}

.dokumenti-calendar-dropdown-right {
    left: auto;
    right: 0;
}

.dokumenti-date-input-wrapper .calendar-icon-btn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(82, 5, 5, 0.14);
}

.dokumenti-date-input {
    flex: 1;
    min-width: 0;
    height: 46px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 0 14px;
    background: #fff;
    font-size: 0.95rem;
}

.dokumenti-date-input:focus {
    outline: none;
    border-color: #520505;
    box-shadow: 0 0 0 3px rgba(82, 5, 5, 0.1);
}

.dokumenti-date-input[readonly] {
    cursor: pointer;
}

@media (max-width: 768px) {
    .dokumenti-calendar-dropdown,
    .dokumenti-calendar-dropdown-right {
        left: 0;
        right: auto;
        width: 100%;
        max-width: 100%;
    }
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 2px;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
}

.filter-btn-primary {
    background: #520505;
    color: white;
}

.filter-btn-primary:hover {
    background: #7a0f0f;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(82,5,5,0.2);
}

.filter-btn-reset {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.filter-btn-reset:hover {
    background: #e9ecef;
    color: #520505;
    transform: translateY(-2px);
}

/* Datuma ievades lauku stili */


/* Aktīvo filtru indikatori */
.active-filters {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 12px 15px;
    background: rgba(82,5,5,0.05);
    border-radius: 10px;
    border-left: 4px solid #520505;
}

.active-filters-label {
    font-weight: 600;
    color: #520505;
    font-size: 0.95rem;
    white-space: nowrap;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: white;
    border-radius: 30px;
    font-size: 0.9rem;
    color: #520505;
    border: 1px solid #520505;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.filter-tag-remove {
    color: #999;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    transition: all 0.2s;
}

.filter-tag-remove:hover {
    background: #520505;
    color: white;
}

/* Kategoriju birkas */
.kategorija-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== RESPONSĪVAIS DIZAINS ===== */
@media (max-width: 768px) {
    .dokumenti-view-switcher {
        width: 100%;
        justify-content: stretch;
    }

    .view-switch-btn {
        flex: 1;
        justify-content: center;
    }

    .dokumenti-cards-view {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .filters-container {
        padding: 15px;
    }
    
    .filters-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-group {
        width: 100%;
        min-width: 100%;
    }
    
    .filter-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .filter-btn {
        width: 100%;
        justify-content: center;
    }
    
    .active-filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .filter-tags {
        width: 100%;
    }
    
    .filter-tag {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-actions {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }
}

@media (max-width: 992px) {
    .tabula {
        font-size: 0.9rem;
    }
    
    .tabula th,
    .tabula td {
        padding: 10px 12px;
    }
    
    .tabula th:first-child,
    .tabula td:first-child {
        padding-left: 15px;
    }
    
    .tabula th:last-child,
    .tabula td:last-child {
        padding-right: 15px;
    }
    
    .btn-lejupielade-icon {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 768px) {
    .dokumenti-page {
        padding: 30px 0;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .container {
        padding: 0 15px;
    }

    .tabula {
        font-size: 0.85rem;
    }

    .tabula th,
    .tabula td {
        padding: 8px 10px;
    }
    
    .tabula th:first-child,
    .tabula td:first-child {
        padding-left: 12px;
    }
    
    .tabula th:last-child,
    .tabula td:last-child {
        padding-right: 12px;
    }

    .btn-lejupielade-icon {
        width: 30px;
        height: 30px;
    }

    .btn-lejupielade-icon i {
        font-size: 0.9rem;
    }
}

/* Mobilā versija - līdz 768px */
@media (max-width: 768px) {
    /* Paslēpj 2. un 3. kolonnu (datums un izmērs) */
    .tabula th:nth-child(2),
    .tabula th:nth-child(3),
    .tabula td:nth-child(2),
    .tabula td:nth-child(3) {
        display: none;
    }
    
    /* Pārrēķina kolonnu platumus pēc paslēpšanas (Kategorija slēpta mobilajā) */
    .tabula th:nth-child(1) { width: 80%; }  /* Datne */
    .tabula th:nth-child(4) { width: 0; }    /* Kategorija (slēpta) */
    .tabula th:nth-child(5) { width: 20%; }  /* Lejupielādēt */
}

@media (max-width: 576px) {
    .dokumenti-cards-view {
        grid-template-columns: 1fr;
    }

    .dokumenta-card {
        min-height: 230px;
    }

    .tabula {
        font-size: 0.8rem;
    }
    
    .tabula th,
    .tabula td {
        padding: 6px 8px;
    }
    
    .tabula th:first-child,
    .tabula td:first-child {
        padding-left: 10px;
    }
    
    .tabula th:last-child,
    .tabula td:last-child {
        padding-right: 10px;
    }
    
    .pagination-simple {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination-link {
        width: 100%;
        text-align: center;
    }
    
    /* Pārrēķina kolonnu platumus vēl mazākiem ekrāniem (Kategorija slēpta) */
    .tabula th:nth-child(1) { width: 80%; }  /* Datne */
    .tabula th:nth-child(4) { width: 0; }    /* Kategorija (slēpta) */
    .tabula th:nth-child(5) { width: 20%; }  /* Lejupielādēt */
}

@media (max-width: 480px) {
    .dokumenti-page {
        padding: 20px 0;
    }

    .section-title {
        font-size: 1.5rem;
        padding-bottom: 8px;
    }

    .container {
        padding: 0 10px;
    }

    .tabula {
        font-size: 0.75rem;
    }

    .tabula th,
    .tabula td {
        padding: 5px 6px;
    }
    
    .tabula th:first-child,
    .tabula td:first-child {
        padding-left: 8px;
    }
    
    .tabula th:last-child,
    .tabula td:last-child {
        padding-right: 8px;
    }

    .btn-lejupielade-icon {
        width: 28px;
        height: 28px;
    }

    .btn-lejupielade-icon i {
        font-size: 0.8rem;
    }
    
    /* Pārrēķina kolonnu platumus mazākajiem ekrāniem (Kategorija slēpta) */
    .tabula th:nth-child(1) { width: 80%; }  /* Datne */
    .tabula th:nth-child(4) { width: 0; }    /* Kategorija (slēpta) */
    .tabula th:nth-child(5) { width: 20%; }  /* Lejupielādēt */
}