/**
 * Frontend Styles for System Dokumentacji
 * Methodology: BEM
 */

.doc-explorer {
    width: 100%;
    margin: 20px 0;
    font-family: inherit;
}

/* Filter Form Layout */
.doc-explorer__filter {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background-color: #fff;
    padding: 40px;
    margin-bottom: 30px;
    border: 1px solid #eee;
    flex-wrap: wrap;
    gap: 40px;
}

.doc-explorer__filter-info {
    flex: 1;
    min-width: 300px;
}

.doc-explorer__filter-title {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
    color: #222;
}

.doc-explorer__filter-desc {
    margin: 0;
    color: #777;
    font-size: 15px;
    line-height: 1.6;
}

.doc-explorer__filter-form-wrapper {
    flex: 1;
    min-width: 350px;
}

.doc-explorer__filter-form-title {
    margin: 0 0 20px 0;
    font-size: 14px;
    font-weight: 800;
    color: #222;
    letter-spacing: 1px;
}

.doc-explorer__filter-fields {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.doc-explorer__filter-select,
.doc-explorer__filter-input {
    background-color: #f2f2f2;
    border: 1px solid #f2f2f2;
    padding: 0 15px;
    font-size: 14px;
    color: #333;
    height: 50px;
    outline: none;
    border-radius: 0;
    transition: border-color 0.2s;
}

.doc-explorer__filter-select:focus,
.doc-explorer__filter-input:focus {
    border-color: #58479b;
}

.doc-explorer__filter-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.doc-explorer__filter-separator {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-align: center;
    margin: 5px 0;
}

.doc-explorer__filter-submit {
    background-color: #58479b;
    color: #fff;
    border: none;
    padding: 0 25px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s ease;
    height: 50px;
    width: 100%;
    border-radius: 0;
    text-transform: uppercase;
}

.doc-explorer__filter-submit:hover {
    background-color: #45367a;
}

.doc-explorer__filter-submit .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Loading Spinner */
.sd-loading-spinner {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #58479b;
    border-radius: 50%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.sd-loading-spinner--visible {
    opacity: 1;
    visibility: visible;
    animation: sd-spin 1s linear infinite;
}

@keyframes sd-spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

.doc-explorer__filter-select.sd-loading {
    padding-right: 45px;
}

/* Error Message */
.sd-error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 0;
    padding: 12px 15px;
    margin-top: 10px;
    font-size: 14px;
    animation: sd-fadeIn 0.3s;
}

@keyframes sd-fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Breadcrumbs */
.doc-explorer__breadcrumbs {
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.doc-explorer__breadcrumb-item {
    text-decoration: none;
    color: #222;
    font-weight: 600;
}

.doc-explorer__breadcrumb-item:hover {
    text-decoration: underline;
}

.doc-explorer__breadcrumb-item--current {
    color: #888;
    font-weight: normal;
}

.doc-explorer__breadcrumb-sep {
    margin: 0 8px;
    color: #ccc;
}

.doc-explorer__breadcrumb-filters {
    font-size: 13px;
    color: #999;
    font-style: italic;
}

/* Table Styles */
.doc-explorer__table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.doc-explorer__thead {
    background-color: #222;
    color: #fff;
}

.doc-explorer__th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.doc-explorer__row {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.doc-explorer__row:hover {
    background-color: #f9f9f9;
}

.doc-explorer__cell {
    padding: 15px 20px;
    vertical-align: middle;
    color: #333;
}

.doc-explorer__cell--name {
    display: flex;
    align-items: center;
}

.doc-explorer__cell--name .dashicons {
    margin-right: 12px;
    color: #555;
}

.doc-explorer__link {
    text-decoration: none;
    color: #222;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.doc-explorer__link:hover {
    color: #000;
}

.doc-explorer__link--pdf {
    cursor: pointer;
    transition: color 0.2s ease;
}

.doc-explorer__link--pdf:hover {
    color: #58479b;
}

.doc-explorer__link--pdf:hover .dashicons {
    color: #58479b;
}

.doc-explorer__cell--size {
    color: #777;
    font-size: 14px;
}

.doc-explorer__cell--action {
    text-align: right;
}

/* Button Styles */
.doc-explorer__button {
    display: inline-block;
    padding: 8px 20px;
    border: 2px solid #222;
    background-color: #fff;
    color: #222;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.doc-explorer__button:hover {
    background-color: #222;
    color: #fff;
}

/* Pagination */
.doc-explorer__pagination {
    margin-top: 30px;
    padding: 20px;
    text-align: center;
    background-color: #fff;
    border: 1px solid #eee;
}

.doc-explorer__pagination .page-numbers {
    display: inline-block;
    padding: 8px 15px;
    margin: 0 5px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    transition: all 0.2s ease;
}

.doc-explorer__pagination .page-numbers:hover {
    background-color: #f5f5f5;
    border-color: #58479b;
    color: #58479b;
}

.doc-explorer__pagination .page-numbers.current {
    background-color: #58479b;
    color: #fff;
    border-color: #58479b;
}

/* Table Wrapper */
.doc-explorer__table-wrapper {
    width: 100%;
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Mobile ── */
@media screen and (max-width: 768px) {

    /* Filter form */
    .doc-explorer__filter {
        padding: 20px;
        flex-direction: column;
        gap: 24px;
    }

    .doc-explorer__filter-info,
    .doc-explorer__filter-form-wrapper {
        width: 100%;
        min-width: 0;
    }

    /* Breadcrumbs — większy tap target, poziomy scroll gdy długie */
    .doc-explorer__breadcrumbs {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 10px 0;
        margin-bottom: 12px;
        font-size: 15px;
        gap: 0;
    }

    .doc-explorer__breadcrumbs::-webkit-scrollbar {
        display: none;
    }

    .doc-explorer__breadcrumb-item {
        white-space: nowrap;
        padding: 8px 4px;
        font-size: 15px;
    }

    .doc-explorer__breadcrumb-sep {
        margin: 0 4px;
        flex-shrink: 0;
    }

    /* Ukryj thead — tabela staje się listą kart */
    .doc-explorer__thead {
        display: none;
    }

    .doc-explorer__table,
    .doc-explorer__tbody {
        display: block;
        width: 100%;
    }

    /* Każdy wiersz = karta */
    .doc-explorer__row {
        display: flex;
        align-items: center;
        padding: 14px 16px;
        border-bottom: 1px solid #eee;
        gap: 12px;
        min-height: 60px;
    }

    /* Nazwa zajmuje cały dostępny obszar */
    .doc-explorer__cell--name {
        flex: 1 1 auto;
        padding: 0;
        min-width: 0;
        display: flex;
        align-items: center;
    }

    .doc-explorer__cell--name .dashicons {
        flex-shrink: 0;
    }

    .doc-explorer__link {
        white-space: normal;
        word-break: break-word;
        font-size: 15px;
        line-height: 1.4;
    }

    /* Rozmiar — mała etykieta, nie zajmuje miejsca */
    .doc-explorer__cell--size {
        flex: 0 0 auto;
        padding: 0;
        font-size: 12px;
        color: #999;
        white-space: nowrap;
    }

    /* Akcja — przycisk zawsze widoczny po prawej */
    .doc-explorer__cell--action {
        flex: 0 0 auto;
        padding: 0;
        text-align: right;
    }

    .doc-explorer__button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 10px 16px;
        font-size: 12px;
        white-space: nowrap;
        min-height: 40px;
    }

    /* Folder row — ikona + nazwa trochę większe */
    .doc-explorer__row--folder .doc-explorer__link {
        font-size: 15px;
        font-weight: 700;
    }

    /* Pagination */
    .doc-explorer__pagination {
        padding: 15px 10px;
    }

    .doc-explorer__pagination .page-numbers {
        padding: 10px 14px;
        margin: 2px;
        font-size: 15px;
        min-width: 44px;
        text-align: center;
    }
}
