/* =============================================
   SPOTIFER V2 – TEMA DINÂMICO + MODAL
   ============================================= */

/* ---------- RESET ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---------- VARIÁVEIS DE TEMA (ESCURO PADRÃO) ---------- */
:root {
    --bg-primary: #000;
    --bg-secondary: rgba(255, 255, 255, 0.03);
    --text-primary: #fff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-hover: rgba(255, 255, 255, 0.08);
    --accent: #667eea;
    --accent-hover: #5a6fd6;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --danger: #ff6b6b;
}

/* Tema claro */
body.light-theme {
    --bg-primary: #f5f5f7;
    --bg-secondary: rgba(0, 0, 0, 0.03);
    --text-primary: #1a1a1a;
    --text-secondary: rgba(0, 0, 0, 0.7);
    --text-muted: rgba(0, 0, 0, 0.5);
    --border: rgba(0, 0, 0, 0.1);
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-hover: rgba(255, 255, 255, 0.9);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --danger: #e74c3c;
}

/* ---------- ESTILOS GLOBAIS ---------- */
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

/* Background decorativo */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: -2;
}

.blur-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
    backdrop-filter: blur(1px);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
}

/* ---------- HEADER ---------- */
.header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;  /* para posicionar o botão de engrenagem */
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo i {
    font-size: 3rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Botão de configurações */
.settings-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}
.settings-btn:hover {
    background: var(--card-hover);
    transform: rotate(90deg);
}

/* ---------- GLASS CARD ---------- */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}
.glass-card:hover {
    background: var(--card-hover);
    transform: translateY(-5px);
}

/* ---------- UPLOAD AREA ---------- */
.upload-section {
    margin-bottom: 3rem;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 15px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--accent);
    background: rgba(102, 126, 234, 0.05);
}

.upload-area.dragover {
    border-color: var(--accent);
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-area i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.upload-area:hover i {
    color: var(--accent);
    transform: scale(1.1);
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.upload-btn {
    background: var(--gradient);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* ---------- ALBUM SECTION ---------- */
.album-section {
    margin-bottom: 3rem;
}

.album-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.album-cover-container {
    position: relative;
    flex-shrink: 0;
}

.album-cover {
    width: 200px;
    height: 200px;
    border-radius: 15px;
    object-fit: cover;
    box-shadow: var(--shadow);
    border: 2px solid var(--border);
}

.edit-cover-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.edit-cover-btn:hover {
    background: var(--accent);
    transform: scale(1.1);
}

.album-info {
    flex: 1;
    padding-top: 1rem;
}

.album-name-input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 100%;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}
.album-name-input:focus {
    outline: none;
    border-color: var(--accent);
}

.album-type {
    display: inline-block;
    background: var(--gradient);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.album-duration {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.track-count {
    font-size: 1rem;
    color: var(--text-muted);
}

/* ---------- TRACKLIST ---------- */
.tracklist-section {
    margin-top: 2rem;
}

.tracklist-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Controles de ordenação */
.sort-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.sort-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.sort-btn:hover {
    background: var(--card-hover);
    color: var(--text-primary);
}

/* Lista */
.tracklist {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 0.5rem;
    border: 1px solid var(--border);
}

/* Item da faixa */
.track {
    display: flex;
    align-items: center;
    padding: 0.8rem 0.8rem 0.8rem 0.5rem;
    border-radius: 8px;
    transition: background 0.2s, box-shadow 0.2s;
    border-bottom: 1px solid var(--border);
    cursor: grab;
    user-select: none;
}
.track:active {
    cursor: grabbing;
}
.track:last-child {
    border-bottom: none;
}
.track:hover {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
body.light-theme .track:hover {
    background: rgba(0, 0, 0, 0.03);
}

.track.dragging {
    opacity: 0.4;
    background: rgba(102, 126, 234, 0.2);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}
.track.drop-zone {
    border-top: 2px solid var(--accent);
}

/* Ícone de arrastar */
.drag-handle {
    width: 24px;
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    pointer-events: none;
}
.track:hover .drag-handle {
    color: var(--text-secondary);
}

.track-number {
    width: 30px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-align: center;
}

.track-info {
    flex: 1;
    margin-left: 0.5rem;
}

.track-name {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    cursor: text;
    transition: all 0.2s;
    border-bottom: 1px dashed transparent;
    display: inline-block;
    padding: 0.1rem 0.2rem;
    border-radius: 4px;
}
.track-name:hover {
    border-bottom-color: var(--border);
    background: var(--bg-secondary);
}

.track-name-input {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    width: 80%;
    outline: none;
}

.track-duration {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---------- ÁREA DE AÇÕES ---------- */
.album-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

.action-btn {
    padding: 1rem 2rem;
    border-radius: 10px;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn.primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.action-btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.action-btn.secondary:hover {
    background: var(--card-hover);
}

/* ---------- MODAL DE CONFIGURAÇÕES ---------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    color: var(--text-primary);
    backdrop-filter: blur(20px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.modal-header h2 {
    font-size: 1.5rem;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: 2rem;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.setting-item:last-child {
    border-bottom: none;
}

.setting-info h3 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}
.setting-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.3s;
}
.theme-toggle:hover {
    background: var(--card-hover);
}
.theme-toggle i {
    font-size: 1rem;
}

.badge {
    background: var(--accent);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.link-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: background 0.2s;
}
.link-btn:hover {
    background: var(--card-hover);
}

.modal-footer {
    text-align: right;
}

/* ---------- RESPONSIVO ---------- */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    .logo h1 {
        font-size: 2rem;
    }
    .album-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .album-cover {
        width: 150px;
        height: 150px;
    }
    .album-actions {
        flex-direction: column;
    }
    .upload-area {
        padding: 2rem;
    }
}

/* ---------- ANIMAÇÕES ---------- */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

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

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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