/* TH Store Catalog PDF - Frontend styles */

.th-catalog-wrap {
    max-width: 960px;
    margin: 40px auto;
    padding: 0 16px;
}

.th-catalog-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: linear-gradient(135deg, #3b1f0f 0%, #5a2e12 100%);
    color: #f5e8d0;
    border-radius: 16px;
    padding: 32px 36px;
    box-shadow: 0 12px 40px rgba(59, 31, 15, 0.25);
    flex-wrap: wrap;
}

.th-catalog-left { flex: 1; min-width: 260px; }

.th-catalog-badge {
    display: inline-block;
    background: rgba(245, 232, 208, 0.15);
    color: #f5e8d0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.th-catalog-heading {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    color: #f5e8d0;
}

.th-catalog-btn {
    background: #f5e8d0;
    color: #3b1f0f;
    border: none;
    border-radius: 10px;
    padding: 15px 28px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
    white-space: nowrap;
}

.th-catalog-btn:hover { background: #fff; transform: translateY(-1px); }

.th-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 3, 0.72);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.th-modal-overlay.is-open { display: flex; }

.th-modal-box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.th-modal-header {
    position: relative;
    padding: 24px 28px 16px;
    border-bottom: 1px solid #eee;
}

.th-modal-header h3 {
    margin: 0 0 4px !important;
    font-size: 19px !important;
    font-weight: 700 !important;
    color: #1a0d05 !important;
}

.th-modal-subtitle {
    margin: 0 !important;
    font-size: 13px !important;
    color: #888 !important;
}

.th-modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: #f0ede8;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, color 0.18s;
}

.th-modal-close:hover { background: #3b1f0f; color: #fff; }

.th-modal-body {
    padding: 18px 28px;
    overflow-y: auto;
    flex: 1;
}

.th-cat-select-all {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #faf6f0;
    border: 2px solid #e8ddd1;
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    color: #1a0d05;
    transition: border-color 0.18s, background 0.18s;
    user-select: none;
    margin-bottom: 14px;
}

.th-cat-select-all:hover { border-color: #c08040; background: #fdf3e7; }
.th-cat-select-all.is-checked { border-color: #3b1f0f; background: #fdf3e7; }

.th-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #ccc;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
}

.th-checkbox svg { width: 12px; height: 10px; opacity: 0; transition: opacity 0.15s; }

.is-checked .th-checkbox,
.th-cat-item.is-checked .th-checkbox {
    background: #3b1f0f;
    border-color: #3b1f0f;
}

.is-checked .th-checkbox svg,
.th-cat-item.is-checked .th-checkbox svg { opacity: 1; }

#th-cat-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

#th-cat-list::-webkit-scrollbar { width: 4px; }
#th-cat-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.th-cat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid #e8ddd1;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s;
    user-select: none;
}

.th-cat-item:hover { border-color: #c08040; background: #fdf8f2; }
.th-cat-item.is-checked { border-color: #3b1f0f; background: #fdf3e7; color: #1a0d05; }

.th-cat-item .th-cat-name {
    flex: 1;
    font-weight: 500;
    line-height: 1.3;
}

.th-cat-item .th-cat-count {
    font-size: 11px;
    color: #aaa;
    background: #f5f0ea;
    padding: 1px 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

.th-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 24px 0;
    margin: 0;
}

.th-error {
    grid-column: 1 / -1;
    text-align: center;
    color: #c00;
    font-size: 13px;
    padding: 18px 0;
    margin: 0;
}

.th-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 28px 22px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.th-cancel-btn,
.th-generate-btn {
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.12s, opacity 0.2s;
}

.th-cancel-btn { background: #eee; color: #333; }
.th-cancel-btn:hover { background: #e0e0e0; }

.th-generate-btn {
    background: #3b1f0f;
    color: #f5e8d0;
    min-width: 150px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.th-generate-btn:hover:not(:disabled) { background: #5a2e12; transform: translateY(-1px); }
.th-generate-btn:disabled { background: #9e8a7a; cursor: not-allowed; opacity: 0.7; }

.th-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(245, 232, 208, 0.35);
    border-top-color: #f5e8d0;
    border-radius: 50%;
    animation: th-spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes th-spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
    .th-catalog-card {
        flex-direction: column;
        text-align: center;
        padding: 24px 20px;
    }
    .th-catalog-heading { font-size: 22px; }
    .th-catalog-btn { width: 100%; }
    #th-cat-list { grid-template-columns: 1fr; }
    .th-modal-box {
        border-radius: 14px 14px 0 0;
        max-height: 95vh;
        margin-top: auto;
    }
    .th-modal-overlay { align-items: flex-end; padding: 0; }
    .th-modal-header, .th-modal-body, .th-modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
}
