/* ==============================================================
 * Unified Add to Library — modal rico que substitui o dropdown
 * "quick-add / advanced-add". Inspirado no quick-add.css existente
 * mas com layout 2-colunas (cover + conteúdo) e abas.
 * ============================================================== */

/* Button — same visual padrão do btn-site; nenhuma regra extra aqui. */

/* -------------------- Modal container -------------------- */
.unified-add-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unified-add-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.unified-add-content {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    width: 92%;
    max-width: 900px;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: unifiedAddSlideIn 0.3s ease-out;
}

.theme-indigo-dark .unified-add-content {
    background: #1e293b;
    color: #e2e8f0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

@keyframes unifiedAddSlideIn {
    from { opacity: 0; transform: translateY(-30px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* -------------------- Header -------------------- */
.unified-add-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.theme-indigo-dark .unified-add-header {
    border-bottom-color: #334155;
}

.unified-add-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 48px);
}

.theme-indigo-dark .unified-add-title {
    color: #e2e8f0;
}

.unified-add-close {
    background: transparent;
    border: 0;
    color: #64748b;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.unified-add-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.theme-indigo-dark .unified-add-close:hover {
    background: #334155;
    color: #e2e8f0;
}

/* -------------------- Body -------------------- */
.unified-add-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    position: relative;
}

.unified-add-loading {
    padding: 60px 24px;
    text-align: center;
}

.unified-add-main {
    display: flex;
    gap: 24px;
    padding: 24px;
}

/* Mobile: stack */
@media (max-width: 768px) {
    .unified-add-main {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }
}

/* -------------------- Left: cover + meta -------------------- */
.unified-add-left {
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 768px) {
    .unified-add-left {
        flex: 0 0 auto;
        flex-direction: row;
        align-items: flex-start;
    }
}

.unified-add-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: #f1f5f9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .unified-add-cover-wrapper {
        width: 120px;
        flex-shrink: 0;
    }
}

.theme-indigo-dark .unified-add-cover-wrapper {
    background: #334155;
}

.unified-add-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.unified-add-cover-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 3rem;
}

.unified-add-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 768px) {
    .unified-add-meta { flex: 1; }
}

.unified-add-meta-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.875rem;
    color: #475569;
}

.theme-indigo-dark .unified-add-meta-row {
    color: #cbd5e1;
}

.unified-add-meta-row > i {
    flex-shrink: 0;
    margin-top: 3px;
    color: #667eea;
    width: 16px;
}

.unified-add-meta-row > span {
    line-height: 1.4;
    word-break: break-word;
}

/* -------------------- Right: tabs + content + form -------------------- */
.unified-add-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Tabs */
.unified-add-tabs {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #e2e8f0;
    gap: 4px;
}

.theme-indigo-dark .unified-add-tabs {
    border-bottom-color: #334155;
}

.unified-add-tab {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s;
    user-select: none;
}

.unified-add-tab:hover {
    color: #1e293b;
}

.theme-indigo-dark .unified-add-tab {
    color: #94a3b8;
}

.theme-indigo-dark .unified-add-tab:hover {
    color: #e2e8f0;
}

.unified-add-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.theme-indigo-dark .unified-add-tab.active {
    color: #818cf8;
    border-bottom-color: #818cf8;
}

.unified-add-tab > i {
    margin-right: 6px;
}

.unified-add-tab-content {
    padding: 4px 0;
    min-height: 80px;
    max-height: 280px;
    overflow-y: auto;
}

.unified-add-tab-content:not(.active) {
    display: none;
}

.unified-add-description {
    margin: 0;
    line-height: 1.5;
    font-size: 0.9rem;
    color: #475569;
    white-space: pre-wrap;
}

.theme-indigo-dark .unified-add-description {
    color: #cbd5e1;
}

/* Screenshots grid */
.unified-add-screenshots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.unified-add-screenshot {
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
}

.theme-indigo-dark .unified-add-screenshot {
    background: #334155;
}

.unified-add-screenshot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.unified-add-screenshot:hover img {
    transform: scale(1.05);
}

/* -------------------- Form -------------------- */
.unified-add-form {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.theme-indigo-dark .unified-add-form {
    border-top-color: #334155;
}

.unified-add-form-title {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-indigo-dark .unified-add-form-title {
    color: #e2e8f0;
}

.unified-add-form-title > i {
    color: #667eea;
}

.unified-add-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

@media (max-width: 480px) {
    .unified-add-form-row {
        grid-template-columns: 1fr;
    }
}

.unified-add-form .form-group {
    margin-bottom: 12px;
}

.unified-add-form .form-label {
    font-size: 0.8rem;
    margin-bottom: 4px;
    font-weight: 500;
    color: #475569;
}

.theme-indigo-dark .unified-add-form .form-label {
    color: #cbd5e1;
}

.unified-add-form .form-select {
    font-size: 0.875rem;
}

/* Fix: Bootstrap 5 .is-invalid em <select> adiciona icone SVG como background-image.
 * Algum CSS pai do tema faz repeat e o icone vira mosaico cobrindo o select.
 * Forcar no-repeat + tirar o icone de erro (a borda vermelha + invalid-feedback ja sinalizam o erro). */
.unified-add-modal .form-select.is-invalid,
.unified-add-modal .form-control.is-invalid {
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
}

.unified-add-modal .form-select.is-invalid {
    /* Mantem apenas a seta nativa do dropdown, sem o icone de exclamacao do BS5 */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dc3545' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
    background-size: 16px 12px !important;
}

/* -------------------- Progress (anime/manga/serie) -------------------- */
.unified-add-progress-anime,
.unified-add-progress-manga {
    margin-top: 4px;
}

/* Serie accordion toggle (the clickable button row) */
.unified-add-accordion-toggle {
    width: 100%;
    text-align: left;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.15s, border-color 0.15s;
}

.unified-add-accordion-toggle:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.unified-add-accordion-toggle[aria-expanded="true"] {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.theme-indigo-dark .unified-add-accordion-toggle {
    background: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

.theme-indigo-dark .unified-add-accordion-toggle:hover {
    background: #3f4f64;
}

.theme-indigo-dark .unified-add-accordion-toggle[aria-expanded="true"] {
    background: #3b3f6e;
    border-color: #4f46e5;
}

.unified-add-accordion-chevron {
    transition: transform 0.2s;
    flex-shrink: 0;
    width: 12px;
}

.unified-add-accordion-hint {
    margin-left: auto;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 400;
}

.theme-indigo-dark .unified-add-accordion-hint {
    color: #94a3b8;
}

/* Accordion body — open state */
.unified-add-accordion-body {
    margin-top: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.theme-indigo-dark .unified-add-accordion-body {
    background: #1e293b;
    border-color: #334155;
}

/* One season row inside the accordion */
.unified-add-season-row {
    display: grid;
    grid-template-columns: 1fr 100px;
    gap: 10px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
}

.unified-add-season-row:last-child {
    border-bottom: 0;
}

.theme-indigo-dark .unified-add-season-row {
    border-bottom-color: #334155;
}

.unified-add-season-label {
    margin: 0;
    font-size: 0.85rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.unified-add-season-label > small {
    margin-left: 4px;
    font-size: 0.75rem;
    opacity: 0.8;
}

.theme-indigo-dark .unified-add-season-label {
    color: #cbd5e1;
}

.unified-add-season-input {
    font-size: 0.85rem;
    padding: 4px 8px;
    height: auto;
}

/* -------------------- Footer -------------------- */
.unified-add-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.theme-indigo-dark .unified-add-footer {
    border-top-color: #334155;
}

@media (max-width: 480px) {
    .unified-add-footer {
        padding: 12px 16px;
    }

    .unified-add-footer .btn-site {
        flex: 1;
        justify-content: center;
    }
}

/* -------------------- HowLongToBeat block (games only) --------------------
   Neutral, low-key styling — same hierarchy as other meta info, just grouped
   in its own block so the 3 values don't get lost among genres/platforms. */
.unified-add-hltb {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.theme-indigo-dark .unified-add-hltb {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.unified-add-hltb-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.theme-indigo-dark .unified-add-hltb-title {
    color: #94a3b8;
}

.unified-add-hltb-title > i {
    font-size: 0.8rem;
    color: #94a3b8;
}

.unified-add-hltb-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.unified-add-hltb-item {
    text-align: center;
    padding: 6px 4px;
}

.unified-add-hltb-label {
    font-size: 0.6rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-indigo-dark .unified-add-hltb-label {
    color: #94a3b8;
}

.unified-add-hltb-label > i {
    font-size: 0.65rem;
}

.unified-add-hltb-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1;
}

.theme-indigo-dark .unified-add-hltb-value {
    color: #f1f5f9;
}

/* Steam price block — same card pattern as HLTB */
.unified-add-steam,
.unified-add-itad {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.theme-indigo-dark .unified-add-steam,
.theme-indigo-dark .unified-add-itad {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.unified-add-steam-title,
.unified-add-itad-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.theme-indigo-dark .unified-add-steam-title,
.theme-indigo-dark .unified-add-itad-title {
    color: #94a3b8;
}

.unified-add-steam-title > i,
.unified-add-itad-title > i {
    font-size: 0.85rem;
    color: #94a3b8;
}

.unified-add-steam-body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.9rem;
}

.unified-add-steam-price {
    font-weight: 700;
    color: #1e293b;
}

.theme-indigo-dark .unified-add-steam-price {
    color: #f1f5f9;
}

.unified-add-steam-original {
    color: #94a3b8;
    text-decoration: line-through;
    font-size: 0.85rem;
}

.unified-add-steam-cut {
    background: #dc2626;
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.unified-add-steam-free {
    color: #16a34a;
    font-weight: 600;
}

.unified-add-steam-link {
    margin-left: auto;
    color: #94a3b8;
    font-size: 0.75rem;
    text-decoration: none;
}

.unified-add-steam-link:hover {
    color: #1e293b;
}

.theme-indigo-dark .unified-add-steam-link:hover {
    color: #f1f5f9;
}

/* ITAD deals block */
.unified-add-itad-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    text-decoration: none;
    color: inherit;
    font-size: 0.85rem;
}

.unified-add-itad-row:last-of-type {
    border-bottom: none;
}

.unified-add-itad-row:hover {
    color: #6366f1;
}

.unified-add-itad-shop {
    flex: 1;
    font-weight: 500;
    color: #475569;
}

.theme-indigo-dark .unified-add-itad-shop {
    color: #cbd5e1;
}

.unified-add-itad-cut {
    background: #dc2626;
    color: #fff;
    font-weight: 700;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 4px;
}

.unified-add-itad-price {
    font-weight: 700;
    color: #16a34a;
}

.unified-add-itad-lowest {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(148, 163, 184, 0.3);
    font-size: 0.75rem;
    color: #64748b;
}

.theme-indigo-dark .unified-add-itad-lowest {
    color: #94a3b8;
}
