/* ============================================ */
/* ARQUIVO: app.css                            */
/* ============================================ */

/* ===== ESTILOS GERAIS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: background 0.3s ease, color 0.3s ease;
    padding-top: 30px;
}

/* ===== TEMA ESCURO (padrão) ===== */
body.dark {
    background: #0f0f1a;
    color: #e0e0ff;
}

body.dark .app {
    background: #1a1a2e;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

body.dark .header .logo-icon {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: #1a1a2e;
}

body.dark .header h1 {
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark .header .logo-sub {
    color: #8888aa;
}

body.dark .header .status-badge {
    color: #8888aa;
    background: #252540;
}

body.dark .btn-sound {
    background: #24243e;
    color: #d4d4f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark .btn-sound:hover {
    background: #2d2d4a;
}

body.dark .btn-sound .status-icon {
    color: #6666aa;
}

body.dark .btn-sound.playing {
    background: #2d2d5a;
    border: 1px solid rgba(167, 139, 250, 0.25);
    box-shadow: 0 0 30px rgba(167, 139, 250, 0.05);
}

body.dark .btn-sound.playing .label {
    color: #ffffff;
}

body.dark .footer {
    color: #555577;
    border-top: 1px solid #22223a;
}

body.dark .footer i {
    color: #666688;
}

body.dark .theme-toggle {
    background: #252540;
    color: #a78bfa;
    border: 1px solid #333355;
}

body.dark .theme-toggle:hover {
    background: #2d2d4a;
    border-color: #555577;
}

body.dark .install-btn {
    background: #7c3aed;
    color: #ffffff;
    border: none;
}

body.dark .install-btn:hover {
    background: #6d28d9;
}

body.dark .install-banner {
    background: #1f1f3a;
    border: 1px solid #333355;
}

body.dark .profile-actions {
    background: #1f1f3a;
    border: 1px solid #333355;
}

body.dark .profile-actions button {
    background: #24243e;
    color: #d4d4f0;
    border: 1px solid #333355;
}

body.dark .profile-actions button:hover {
    background: #2d2d4a;
}

body.dark .section-title {
    color: #8888aa;
    border-bottom-color: #333355;
}

body.dark .audio-list {
    background: #1a1a2e;
}

body.dark .audio-item {
    background: #24243e;
    color: #d4d4f0;
}

body.dark .audio-item:hover {
    background: #2d2d4a;
}

body.dark .audio-item.selected {
    background: #2d2d5a;
    border-color: #7c3aed;
}

body.dark .audio-item .audio-play-btn {
    background: #333355;
    color: #a78bfa;
}

body.dark .audio-item .audio-play-btn:hover {
    background: #444466;
}

body.dark .audio-item .audio-play-btn.playing {
    background: #7c3aed;
    color: #ffffff;
}

body.dark .modal-content {
    background: #1a1a2e;
}

body.dark .modal-audio-item {
    background: #24243e;
    color: #d4d4f0;
}

body.dark .modal-audio-item:hover {
    background: #2d2d4a;
}

body.dark .modal-audio-item.selected {
    background: #2d2d5a;
    border-color: #7c3aed;
}

body.dark .modal-btn-cancel {
    background: #374151;
    color: #ffffff;
}

body.dark .modal-btn-cancel:hover {
    background: #4b5563;
}

/* ===== TEMA CLARO ===== */
body.light {
    background: #f0f0f5;
    color: #1a1a2e;
}

body.light .app {
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

body.light .header .logo-icon {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    color: #ffffff;
}

body.light .header h1 {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light .header .logo-sub {
    color: #6b6b8a;
}

body.light .header .status-badge {
    color: #6b6b8a;
    background: #e8e8f0;
}

body.light .btn-sound {
    background: #f0f0f8;
    color: #1a1a2e;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

body.light .btn-sound:hover {
    background: #e8e8f0;
}

body.light .btn-sound .status-icon {
    color: #9999bb;
}

body.light .btn-sound.playing {
    background: #e8e0f8;
    border: 1px solid rgba(124, 58, 237, 0.2);
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.05);
}

body.light .btn-sound.playing .label {
    color: #1a1a2e;
}

body.light .btn-sound i:first-child {
    color: #7c3aed;
}

body.light .footer {
    color: #9999bb;
    border-top: 1px solid #e8e8f0;
}

body.light .footer i {
    color: #bbbbdd;
}

body.light .theme-toggle {
    background: #e8e8f0;
    color: #7c3aed;
    border: 1px solid #dddddd;
}

body.light .theme-toggle:hover {
    background: #e0e0ee;
    border-color: #bbbbbb;
}

body.light .install-btn {
    background: #7c3aed;
    color: #ffffff;
    border: none;
}

body.light .install-btn:hover {
    background: #6d28d9;
}

body.light .install-banner {
    background: #f0edf8;
    border: 1px solid #e0d8ee;
}

body.light .profile-actions {
    background: #f0edf8;
    border: 1px solid #e0d8ee;
}

body.light .profile-actions button {
    background: #f0f0f8;
    color: #1a1a2e;
    border: 1px solid #dddddd;
}

body.light .profile-actions button:hover {
    background: #e8e8f0;
}

body.light .section-title {
    color: #6b6b8a;
    border-bottom-color: #e8e8f0;
}

body.light .audio-list {
    background: #f8f8fc;
}

body.light .audio-item {
    background: #f0f0f8;
    color: #1a1a2e;
}

body.light .audio-item:hover {
    background: #e8e8f0;
}

body.light .audio-item.selected {
    background: #e8e0f8;
    border-color: #7c3aed;
}

body.light .audio-item .audio-play-btn {
    background: #e8e8f0;
    color: #7c3aed;
}

body.light .audio-item .audio-play-btn:hover {
    background: #dddddd;
}

body.light .audio-item .audio-play-btn.playing {
    background: #7c3aed;
    color: #ffffff;
}

body.light .modal-content {
    background: #ffffff;
}

body.light .modal-audio-item {
    background: #f0f0f8;
    color: #1a1a2e;
}

body.light .modal-audio-item:hover {
    background: #e8e8f0;
}

body.light .modal-audio-item.selected {
    background: #e8e0f8;
    border-color: #7c3aed;
}

body.light .modal-btn-cancel {
    background: #e5e7eb;
    color: #1a1a2e;
}

body.light .modal-btn-cancel:hover {
    background: #d1d5db;
}

/* ===== ELEMENTOS COMUNS ===== */
.app {
    border-radius: 32px;
    padding: 28px 24px;
    width: 100%;
    max-width: 800px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.header .logo-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    transition: background 0.3s ease, color 0.3s ease;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.header .logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header .logo-sub {
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.header .right-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.header .status-badge {
    font-size: 12px;
    padding: 4px 14px;
    border-radius: 20px;
    transition: background 0.3s ease, color 0.3s ease;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 6px 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

/* ===== BANNER DE INSTALAÇÃO ===== */
.install-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-radius: 14px;
    margin-bottom: 18px;
    transition: all 0.3s ease;
    gap: 12px;
}

.install-banner.show {
    display: flex;
}

.install-banner .install-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
}

.install-banner .install-info i {
    font-size: 20px;
    color: #7c3aed;
}

.install-btn {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.install-btn i {
    margin-right: 6px;
}

/* ===== PERFIL ===== */
.profile-section {
    margin-bottom: 20px;
}

.profile-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-radius: 14px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.profile-actions button {
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-actions button i {
    font-size: 14px;
}

.profile-actions .btn-add {
    background: #7c3aed;
    color: #ffffff;
    border: none;
}

.profile-actions .btn-add:hover {
    background: #6d28d9;
}

.profile-actions .btn-remove {
    background: #dc2626;
    color: #ffffff;
    border: none;
}

.profile-actions .btn-remove:hover {
    background: #b91c1c;
}

.profile-actions .btn-remove:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.profile-actions .btn-export {
    background: #059669;
    color: #ffffff;
    border: none;
}

.profile-actions .btn-export:hover {
    background: #047857;
}

.profile-actions .btn-import {
    background: #2563eb;
    color: #ffffff;
    border: none;
}

.profile-actions .btn-import:hover {
    background: #1d4ed8;
}

.profile-actions .btn-clear {
    background: #6b7280;
    color: #ffffff;
    border: none;
}

.profile-actions .btn-clear:hover {
    background: #4b5563;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.section-title span {
    font-weight: 400;
    font-size: 12px;
}

/* ===== AUDIO LISTS ===== */
.audio-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
    min-height: 60px;
    margin-bottom: 16px;
    transition: background 0.3s ease;
}

.audio-list.empty {
    display: flex;
    justify-content: center;
    align-items: center;
    color: #8888aa;
    font-size: 13px;
    font-style: italic;
    min-height: 60px;
}

.audio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    border: 2px solid transparent;
    user-select: none;
    position: relative;
}

.audio-item .audio-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.audio-item .audio-check {
    font-size: 16px;
    color: #7c3aed;
    opacity: 0;
    transition: opacity 0.2s;
}

.audio-item.selected .audio-check {
    opacity: 1;
}

.audio-item .audio-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.audio-item .audio-play-btn i {
    margin: 0;
}

.audio-item .audio-play-btn.playing {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== BOTÕES DE SOM DO PERFIL ===== */
.btn-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.btn-sound {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 12px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    min-height: 110px;
    position: relative;
    transition: all 0.2s ease, background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.btn-sound:active {
    transform: scale(0.95);
}

.btn-sound i:first-child {
    font-size: 32px;
    margin-bottom: 2px;
}

.btn-sound .label {
    font-size: 13px;
    text-align: center;
    word-break: break-word;
    line-height: 1.2;
    max-width: 100%;
    transition: color 0.3s ease;
}

.btn-sound .status-icon {
    font-size: 16px;
    transition: color 0.3s ease;
    margin-top: 2px;
}

body.dark .btn-sound i:first-child {
    color: #a78bfa;
}

body.light .btn-sound i:first-child {
    color: #7c3aed;
}

.btn-sound.playing .status-icon {
    color: #a78bfa;
}

body.light .btn-sound.playing .status-icon {
    color: #7c3aed;
}

/* ===== RODAPÉ ===== */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    font-size: 12px;
    padding-top: 16px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.footer i {
    margin: 0 4px;
    transition: color 0.3s ease;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #1a1a2e;
    border-radius: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: modalSlide 0.3s ease;
}

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

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: #dc2626;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #8888aa;
    transition: color 0.2s;
    padding: 0 8px;
}

.modal-close:hover {
    color: #ffffff;
}

body.light .modal-close:hover {
    color: #1a1a2e;
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body p {
    margin-bottom: 16px;
    color: #8888aa;
    font-size: 14px;
}

.modal-audio-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.modal-audio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    user-select: none;
}

.modal-audio-item .modal-audio-name {
    font-size: 13px;
}

.modal-audio-item .modal-audio-check {
    font-size: 20px;
    color: #7c3aed;
}

.modal-audio-item.selected .modal-audio-check {
    color: #7c3aed;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-btn-confirm {
    background: #dc2626;
    color: #ffffff;
}

.modal-btn-confirm:hover:not(:disabled) {
    background: #b91c1c;
}

.modal-btn-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================================================ */
/* ===== RESPONSIVO ===== */
/* ================================================================ */

@media (max-width: 600px) {
    .app {
        padding: 16px 12px;
        border-radius: 20px;
    }

    .header .logo-icon {
        width: 38px;
        height: 38px;
        font-size: 18px;
        border-radius: 10px;
    }

    .header h1 {
        font-size: 17px;
    }

    .header .logo-sub {
        font-size: 8px;
    }

    .header .status-badge {
        font-size: 10px;
        padding: 3px 10px;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
        font-size: 14px;
        padding: 3px 6px;
    }

    .profile-actions {
        padding: 10px 12px;
        gap: 8px;
    }

    .profile-actions button {
        font-size: 11px;
        padding: 6px 12px;
    }

    .audio-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        padding: 8px;
        gap: 6px;
    }

    .audio-item {
        font-size: 12px;
        padding: 6px 8px;
    }

    .audio-item .audio-play-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .audio-item .audio-name {
        font-size: 11px;
    }

    .btn-group {
        gap: 10px;
    }

    .btn-sound {
        min-height: 100px;
        padding: 14px 10px;
        border-radius: 14px;
        font-size: 13px;
    }

    .btn-sound i:first-child {
        font-size: 28px;
    }

    .btn-sound .label {
        font-size: 12px;
    }

    .btn-sound .status-icon {
        font-size: 14px;
    }

    .install-banner {
        flex-direction: column;
        text-align: center;
        padding: 12px;
        border-radius: 14px;
        gap: 10px;
    }

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

    .footer {
        font-size: 11px;
        padding-top: 12px;
        margin-top: 12px;
    }

    .modal-content {
        max-width: 95%;
        margin: 10px;
    }

    .modal-header h3 {
        font-size: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }
}

@media (max-width: 400px) {
    .app {
        padding: 12px 10px;
        border-radius: 16px;
    }

    .header .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
        border-radius: 8px;
    }

    .header h1 {
        font-size: 15px;
    }

    .btn-sound {
        min-height: 85px;
        padding: 12px 8px;
        border-radius: 12px;
        font-size: 12px;
    }

    .btn-sound i:first-child {
        font-size: 24px;
    }

    .btn-sound .label {
        font-size: 11px;
    }

    .audio-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .audio-item {
        font-size: 11px;
        padding: 5px 6px;
    }

    .audio-item .audio-play-btn {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .audio-item .audio-name {
        font-size: 10px;
    }
}