/**
 * Modal styles – WooCommerce Fotosběrna configurator.
 *
 * @package Aw3smPhotoLab\Frontend
 */

/* ── Animations ──────────────────────────────────────────────── */
@keyframes apl-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Top bar ─────────────────────────────────────────────────── */
.apl-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}

#apl-global-attrs-container .apl-qty-wrap {
    max-width: 140px;
}

.apl-flex {
    display: flex;
}

.apl-flex-wrap {
    flex-wrap: wrap;
}

.apl-flex-gap-1 {
    gap: 1rem;
}

.apl-flex.apl-align-items-center {
    align-items: center;
}

.apl-flex.apl-justify-content-space-between {
    justify-content: space-between;
}

#apl-global-settings-panel p {
    margin-top: 10px;
}

.apl-mb-1 {
    margin-bottom: 1rem;
}

button.apl-btn.apl-btn-small {
    padding: 5px 10px;
    font-size: 12px;
    gap: 4px;
}

button.apl-btn {
    --apl-btn-background: #101010;
    --apl-btn-color: #FFFFFF;

    background: var(--apl-btn-background);
    color: var(--apl-btn-color);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

button.apl-btn:hover {
    --apl-btn-background: #232323;
    background: var(--apl-btn-background);
}

button.apl-btn.apl-btn-outline {
    background: none;
    border: 1px solid var(--apl-btn-background);
    color: var(--apl-btn-background);
}

button.apl-btn.apl-btn-outline:hover {
    background: none;
}

button.apl-btn.apl-btn-danger {
    --apl-btn-background: #e72300;
    background: none;
    border: 1px solid var(--apl-btn-background);
    color: var(--apl-btn-background);
}

button.apl-btn.apl-btn-danger:hover {
    background: none;
}


.apl-view-toggles {
    display: flex;
    gap: 10px;
    align-items: center;
}

button.apl-view-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    color: #666;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
}

button.apl-view-btn:hover {
    color: #666;
    background: #eee;
}

button.apl-view-btn.active {
    color: #333;
    background: #e0e0e0;
    border-color: #aaa;
}

/* ── Quantity inputs (spin buttons) ──────────────────────────── */
input[type="number"].apl-item-qty::-webkit-outer-spin-button,
input[type="number"].apl-item-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"].apl-item-qty {
    -moz-appearance: textfield;
}

/* ── Shared Qty Component (used in global panel + item rows) ─── */
/* Hlavní obal - vynucení tvaru a velikosti */
div.apl-qty-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 50px;
    overflow: hidden;
    background-color: #fff;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    height: 40px;
    vertical-align: middle;
}

/* Tlačítka + a - v rámci obalu */
div.apl-qty-wrap button.apl-qty-btn {
    background-color: #f5f5f5;
    color: #333;
    border: none;
    padding: 0 15px;
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    outline: none;
    height: 100%;
    box-sizing: border-box;
    box-shadow: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

div.apl-qty-wrap button.apl-qty-btn:hover {
    background-color: #e0e0e0;
}

/* Input pole uprostřed s řetězením všech jeho tříd pro maximální sílu */
div.apl-qty-wrap input.apl-item-qty.apl-global-qty-field,
div.apl-qty-wrap input.apl-item-qty {
    border: none;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    border-radius: 0 !important;
    text-align: center;
    width: auto !important;

    min-width: 50px !important;
    padding: 0;
    margin: 0;
    font-size: 16px;
    outline: none;
    background: transparent;
    box-sizing: border-box;
    height: 100%;
    box-shadow: none;
    line-height: normal;
    -moz-appearance: textfield;
}

/* Skrytí šipek */
div.apl-qty-wrap input.apl-item-qty::-webkit-outer-spin-button,
div.apl-qty-wrap input.apl-item-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Shared Select Component (used in global panel + item rows) ─ */
select.apl-global-select-field,
select.apl-sort-select,
.apl-dynamic-attr {
    padding: 4px 6px !important;
    font-size: 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
}

.apl-global-select-field:focus,
.apl-dynamic-attr:focus {
    outline: 1px solid #3982bc;
    border-color: #3982bc;
}

/* ── Grid view ───────────────────────────────────────────────── */
.apl-view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.apl-view-grid .apl-item-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.apl-view-grid .apl-item-header {
    padding: 7px 30px 7px 8px;
    font-size: 12px;
    font-weight: bold;
    text-align: left;
    border-bottom: 1px solid #eee;
    background: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.apl-view-grid .apl-item-header .apl-chk-icon {
    flex-shrink: 0;
    color: #ccc;
    transition: color 0.15s;
}

.apl-view-grid .apl-item-header.is-selected .apl-chk-icon {
    color: #444;
}

.apl-view-grid .apl-item-header .apl-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apl-view-list .apl-item-sub {
    width: 120px;
}

.apl-view-grid .apl-item-sub {
    display: flex;
    justify-content: space-between;
    padding: 6px 12px;
    align-items: center;
    background: #fff;
    font-size: 12px;
    border-bottom: 1px solid #eee;
}

.apl-view-grid .apl-item-image-wrap {
    width: 100%;
    aspect-ratio: 4/3;
    background: #eaeaea;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.apl-view-grid .apl-item-image {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.apl-view-grid .apl-item-attrs {
    display: flex;
    flex-direction: column;
    background: #fff;
}

.apl-view-grid .apl-attr-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: #555;
}

.apl-view-grid .apl-dynamic-attr {
    text-align: left;
    max-width: 120px;
}

.apl-view-grid .apl-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.apl-view-grid .apl-delete-btn:hover {
    color: #cc0000;
}

/* ── List view ───────────────────────────────────────────────── */
.apl-view-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.apl-view-list .apl-item-card {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #f9f9f9;
    gap: 15px;
    position: relative;
}

.apl-view-list .apl-item-image-wrap {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    background: #eee;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    overflow: hidden;
}

.apl-view-list .apl-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.apl-view-list .apl-item-header {
    flex: 1;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #111;
    border: none;
    background: transparent;
    padding: 0;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.apl-view-list .apl-item-header .apl-chk-icon {
    flex-shrink: 0;
    color: #ccc;
    transition: color 0.15s;
}

.apl-view-list .apl-item-header.is-selected .apl-chk-icon {
    color: #444;
}

.apl-view-list .apl-item-header .apl-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apl-view-list .apl-item-sub {
    display: flex;
    gap: 15px;
    align-items: center;
    border: none;
    background: transparent;
    padding: 0;
}

.apl-view-list .apl-item-attrs {
    display: flex;
    gap: 10px;
    flex-direction: row;
    align-items: center;
    border: none;
    padding: 0;
}

.apl-view-list .apl-attr-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-size: 12px;
    font-weight: bold;
    gap: 2px;
    color: #444;
}

.apl-view-list .apl-dynamic-attr {
    max-width: 140px;
}

.apl-view-list .apl-delete-btn {
    color: #cc0000;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    font-weight: bold;
    padding: 0 5px;
    line-height: 1;
    margin-left: 10px;
}

/* ── Upload bar (per-item) ───────────────────────────────────── */
.apl-item-upload-bar-wrap {
    padding: 6px 12px;
    background: #fff;
    border-top: 1px solid #eee;
    display: none;
}

.apl-item-upload-bar {
    height: 4px;
    border-radius: 2px;
    background: #0071a1;
    width: 0%;
    transition: width 0.5s;
}

.apl-item-upload-bar-wrap span {
    font-size: 11px;
    color: #777;
    display: block;
    margin-bottom: 3px;
}

.apl-item-error {
    padding: 5px 12px;
    background: #fff0f0;
    border-top: 1px solid #fcc;
    color: #cc0000;
    font-size: 11px;
    display: none;
}

.apl-view-list .apl-low-quality-badge {
    width: 24px;
    height: 24px;
    font-size: 14px;
}

.apl-low-quality-badge {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffcc00;
    color: #5c4600;
    font-size: 30px;
    font-weight: bold;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    z-index: 14;
    cursor: pointer;
}

/* List-view overrides for upload bar */
.apl-view-list .apl-item-upload-bar-wrap {
    padding: 0;
    width: 80px;
    background: transparent;
    border: none;
    align-items: center;
}

.apl-view-list .apl-item-upload-bar {
    height: 3px;
    border-radius: 1px;
}

.apl-view-list .apl-item-upload-bar-wrap span {
    display: none;
}

.apl-view-list .apl-item-error {
    padding: 0;
    background: transparent;
    border: none;
    font-size: 11px;
    width: 80px;
    text-align: right;
    display: none;
}

/* ── Responsive adjustments ──────────────────────────────────── */
@media (max-width: 768px) {
    .apl-top-bar {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }

    #apl-configurator-modal {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    #apl-configurator-modal .apl-modal-content {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
    }

    .apl-view-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    }
}

.apl-hidden-manual {
    display: none !important;
}

.apl-modal-open {
    overflow: hidden !important;
}

.apl-modal-open {
    overflow: hidden !important;
}
