/* ============================================================
   PAINEL DO CRIADOR — CSS (obras.css)
   Tokens herdados de global.css: --accent, --surface, --card,
   --bg, --text-main, --text-dim, --danger, --transition
   ============================================================ */

/* ── 1. LAYOUT PRINCIPAL ── */
.dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    max-width: 1300px;
    margin: 0 auto;
    padding: calc(var(--header-height) + 32px) 24px 60px 24px;
    min-height: 100vh;
    box-sizing: border-box;
    align-items: start;
}

/* ── 2. SIDEBAR ── */
.sidebar {
    position: sticky;
    top: calc(var(--header-height) + 24px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Artist Card */
.artist-card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.artist-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.artist-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-dim);
}

.artist-info h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    word-break: break-word;
}

.artist-role {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Mini stats grid */
.artist-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-stat {
    text-align: center;
}

.mini-stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent);
}

.mini-stat-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filter Nav */
.filter-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 4px;
    padding-left: 4px;
}

.filter-btn {
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
}

.filter-btn.active {
    background: rgba(46, 204, 113, 0.1);
    border-color: rgba(46, 204, 113, 0.3);
    color: var(--accent);
    font-weight: 600;
}

/* New Work Button */
.btn-new-work {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: none;
    background: var(--accent);
    color: #000;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-new-work:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(46, 204, 113, 0.3);
}

.btn-icon-plus {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}

/* ── 3. WORKS AREA ── */
.works-area {
    min-width: 0; /* evita overflow no grid */
}

.works-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.works-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-main);
}

.works-header h2 span {
    color: var(--accent);
}

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

/* ── 4. WORK CARD ── */
.work-card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.work-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* Thumb */
.work-thumb {
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}

.work-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.work-thumb-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.08);
    font-size: 4rem;
    font-weight: 300;
}

.work-card:hover .work-thumb img {
    transform: scale(1.05);
}

/* Badges sobre a thumb */
.work-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    gap: 6px;
    z-index: 2;
}

.work-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
    letter-spacing: 0.3px;
}

.work-badge.pages {
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
}

.work-badge.visibility {
    font-size: 0.65rem;
    text-transform: uppercase;
}

.work-badge.visibility[data-vis="PUBLIC"] {
    background: rgba(46, 204, 113, 0.25);
    color: #2ecc71;
}

.work-badge.visibility[data-vis="UNLISTED"] {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
}

.work-badge.visibility[data-vis="PRIVATE"] {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

/* Work info */
.work-info {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.work-info h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.work-stats-row {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.work-stats-row span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* Score badge na info */
.work-score {
    margin-top: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 0;
}

.work-score.positive { color: #2ecc71; }
.work-score.negative { color: #e74c3c; }
.work-score.neutral { color: var(--text-dim); }

/* ── 5. WORK ACTIONS OVERLAY ── */
.work-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transform: translateX(6px);
    transition: all 0.25s ease;
    z-index: 3;
}

.work-card:hover .work-actions {
    opacity: 1;
    transform: translateX(0);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    color: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.btn-icon:hover {
    transform: scale(1.1);
}

.btn-icon.stats:hover { background: #3498db; }
.btn-icon.visibility:hover { background: #f1c40f; color: #000; }
.btn-icon.edit:hover { background: var(--accent); color: #000; }
.btn-icon.delete:hover { background: var(--danger); }

/* ── 6. MODAL DE UPLOAD ── */
.modal-lg {
    max-width: 720px !important;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: left !important;
    padding: 32px !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.btn-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.btn-close::before { content: '\00d7'; }

.btn-close:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* Form Grid dentro do modal */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.inputs-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: var(--transition);
    font-family: inherit;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.5);
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

.input-group select {
    cursor: pointer;
    appearance: none;
    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='%23888' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
}

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

/* Upload area */
.upload-area label {
    display: block;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.drop-zone {
    border: 2px dashed rgba(46, 204, 113, 0.3);
    border-radius: 14px;
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    background: rgba(46, 204, 113, 0.03);
    transition: var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(46, 204, 113, 0.08);
}

.drop-zone-content p {
    margin: 8px 0 4px;
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 600;
}

.drop-zone-content small {
    color: var(--text-dim);
    font-size: 0.78rem;
}

.upload-icon {
    font-size: 2rem;
    font-weight: 300;
    color: var(--accent);
    display: block;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    margin-top: 14px;
    max-height: 160px;
    overflow-y: auto;
}

.preview-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 4px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.remove-btn:hover {
    background: #c0392b;
}

/* Tag suggestions */
.tag-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    min-height: 0;
}

.tag-chip {
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    transition: var(--transition);
    user-select: none;
}

.tag-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(46, 204, 113, 0.08);
}

.tag-chip.selected {
    background: rgba(46, 204, 113, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

/* Form actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── 7. MODAIS (reaproveitados) ── */
.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.custom-modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 420px;
    width: 90%;
    text-align: center;
    animation: modalScale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(46, 204, 113, 0.12);
    color: var(--accent);
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

/* Buttons */
.btn-accent,
.btn-danger,
.btn-secondary {
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
    transition: var(--transition);
    font-family: inherit;
}

.btn-accent {
    background: var(--accent);
    color: #000;
}

.btn-accent:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* ── 8. PROCESSING OVERLAY ── */
#processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
}

.processing-content {
    text-align: center;
    color: var(--text-main);
    max-width: 420px;
    padding: 40px;
}

.processing-content h3 {
    font-size: 1.3rem;
    margin: 16px 0 8px;
}

.processing-content p {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin: 4px 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* ── 9. STATUS BAR ── */
.status-bar {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 32px;
    border-radius: 14px;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 11000;
    transition: top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.status-bar.active {
    top: 24px;
}

/* ── 10. STATS GRID (modal) ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px 10px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── 11. EMPTY STATE ── */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 40px;
    background: var(--card);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.empty-state .empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-dim);
    font-size: 1rem;
    margin: 0 0 8px;
}

/* ── 12. RESPONSIVO ── */
@media (max-width: 900px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: calc(var(--header-height) + 20px) 16px 40px 16px;
    }

    .sidebar {
        position: static;
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 12px;
        align-items: center;
        background: var(--card);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 16px;
        padding: 16px;
    }

    .artist-card {
        background: none;
        border: none;
        padding: 0;
        display: flex;
        align-items: center;
        gap: 12px;
        text-align: left;
    }

    .artist-avatar {
        width: 44px;
        height: 44px;
        margin: 0;
    }

    .artist-stats,
    .artist-role {
        display: none;
    }

    .filter-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
        padding: 0;
    }

    .filter-label {
        display: none;
    }

    .filter-btn {
        white-space: nowrap;
        width: auto;
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .btn-new-work {
        width: auto;
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    .btn-icon-plus {
        font-size: 1.1rem;
    }
}

@media (max-width: 600px) {
    .works-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-lg {
        max-width: 100% !important;
        max-height: 100vh;
        border-radius: 0 !important;
        padding: 20px !important;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .works-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .artist-card {
        justify-content: center;
    }

    .filter-nav {
        justify-content: center;
    }

    .btn-new-work {
        width: 100%;
        justify-content: center;
    }
}
