/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 4px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: 0.3s;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transform: translateX(0);
    transition: transform 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

.sidebar-header {
    background: #34495e;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-menu {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.search-container {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.search-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}


.song-list {
    list-style: none;
    padding: 0;
}

.song-item {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.song-item:hover {
    background-color: #f8f9fa;
}

.song-item.active {
    background-color: #e3f2fd;
    border-left: 4px solid #3498db;
}

.song-icon {
    font-size: 1.2rem;
}

.song-info {
    flex: 1;
}

.song-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.song-artist {
    font-size: 0.9rem;
    color: #666;
}

/* Lista de repertórios */
.repertorios-container {
    flex: 1;
}

.repertorios-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.repertorio-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.repertorio-item:hover {
    background-color: #f5f5f5;
}

.repertorio-item.active {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.repertorio-icon {
    font-size: 1.5rem;
    margin-right: 15px;
    width: 30px;
    text-align: center;
}

.repertorio-info {
    flex: 1;
}

.repertorio-nome {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.repertorio-descricao {
    font-size: 0.9rem;
    color: #666;
}

.repertorio-count {
    background-color: #2196f3;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Repertório Cards for Main Screen */
.repertorio-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.repertorio-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #3498db;
}

.repertorio-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #3498db;
}

.repertorio-card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
}

.repertorio-card-description {
    color: #666;
    font-size: 1rem;
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.repertorio-card-count {
    background: #3498db;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-block;
}

/* Container de músicas */
.musicas-container {
    flex: 1;
}

.repertorio-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.btn-voltar {
    background: none;
    border: none;
    color: #2196f3;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 5px 0;
    margin-bottom: 10px;
    text-decoration: underline;
}

.btn-voltar:hover {
    color: #1976d2;
}

#repertorioAtualNome {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    background: white;
    min-height: calc(100vh - 80px);
}

/* Repertórios Main Screen */
.repertorios-main-screen {
    max-width: 1200px;
    margin: 0 auto;
}

.repertorios-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e9ecef;
}

.repertorios-header h1 {
    color: #2c3e50;
    margin: 0 0 1rem 0;
    font-size: 3rem;
    font-weight: 700;
}

.repertorios-header p {
    color: #666;
    font-size: 1.2rem;
    margin: 0;
}


.repertorios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    padding: 0;
}

.welcome-content h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.welcome-content p {
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.feature-icon {
    font-size: 2rem;
}

/* Cifra Container */
.cifra-container {
    max-width: 800px;
    margin: 0 auto;
}

.cifra-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
    flex-wrap: nowrap;
    gap: 1rem;
}

.cifra-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

/* Desktop - todos os elementos em uma linha */
@media (min-width: 769px) {
    .cifra-header {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .cifra-navigation {
        flex: 0 0 auto;
        margin-right: 1rem;
    }

    .cifra-header-content {
        flex: 1;
        margin: 0;
    }

    .song-info {
        flex: 1;
        text-align: center;
    }

    .cifra-controls {
        flex: 0 0 auto;
        margin-left: 1rem;
        display: flex;
        gap: 0.5rem;
    }
}

.song-info {
    flex: 1;
    text-align: center;
}

.song-info h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: #2c3e50;
}

.song-details {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.song-artist {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

.song-tonalidade {
    background: #e74c3c;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

.cifra-navigation {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Desktop - textos completos */
@media (min-width: 769px) {
    .cifra-navigation .back-link {
        background: transparent;
        color: #3498db;
        text-decoration: underline;
        padding: 0;
        border-radius: 0;
        font-size: 1rem;
    }

    .cifra-navigation .back-link:hover {
        background: transparent;
        color: #2980b9;
        text-decoration: underline;
    }

    .previous-button,
    .next-button {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
}

.back-link {
    color: #3498db;
    text-decoration: underline;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s;
    display: inline-block;
}

.back-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.next-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.next-button:hover {
    background: #218838;
}

.next-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.previous-button {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.previous-button:hover {
    background: #138496;
}

.previous-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.cifra-controls {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.3s;
    min-width: 50px;
}

.control-btn:hover {
    background: #2980b9;
}

.control-btn.active {
    background: #27ae60;
}

.control-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    opacity: 0.7;
}

.cifra-content {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-x: auto;
    /* Ajustes para rolagem automática */
    overflow-y: auto;
    max-height: 70vh;
}

@media (max-width: 768px) {
    .cifra-content {
        padding: 1rem;
        font-size: 1rem;
        max-height: 82vh;
    }
}

/* Overlay para mobile */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

/* Media Queries para Responsividade */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .main-content {
        margin-left: 280px;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 100%;
        max-width: 350px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .close-menu {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .cifra-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1rem;
    }

    .cifra-header-content {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .song-info {
        flex: 1;
        text-align: left;
    }

    .song-info h2 {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
        line-height: 1.2;
    }

    .song-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .song-artist,
    .song-tonalidade {
        font-size: 0.8rem;
    }

    .cifra-controls {
        flex-direction: row;
        gap: 0.25rem;
        align-items: center;
    }

    .control-btn {
        padding: 0.5rem;
        font-size: 1rem;
        min-width: 40px;
        height: 40px;
        flex: 1;
    }

    .cifra-navigation {
        flex-direction: row;
        gap: 0.5rem;
        width: 100%;
    }

    .cifra-navigation .back-link {
        flex: 1;
        text-align: center;
        background: #6c757d;
        color: white;
        text-decoration: none;
        padding: 0.75rem 0.5rem;
        border-radius: 8px;
        font-size: 0.9rem;
        transition: background-color 0.3s;
    }

    .cifra-navigation .back-link:hover {
        background: #5a6268;
        color: white;
        text-decoration: none;
    }

    .cifra-navigation .nav-buttons {
        display: flex;
        gap: 0.5rem;
        flex: 2;
    }

    .previous-button,
    .next-button {
        flex: 1;
        text-align: center;
        font-size: 0.9rem;
        padding: 0.75rem 0.5rem;
    }

    .song-details {
        gap: 0.5rem;
    }

    .song-artist,
    .song-tonalidade {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }
    
    .overlay.show {
        display: block;
    }
    
    .welcome-content h2 {
        font-size: 1.5rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }

    .repertorio-item {
        padding: 20px 15px;
    }

    .repertorio-icon {
        font-size: 2rem;
        margin-right: 20px;
    }

    .repertorio-nome {
        font-size: 1.1rem;
    }

    .repertorio-descricao {
        font-size: 1rem;
    }

    .btn-voltar {
        font-size: 1rem;
        padding: 10px 0;
    }

    #repertorioAtualNome {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .main-content {
        padding: 0.5rem;
    }
    
    .cifra-content {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .welcome-screen {
        padding: 1rem;
    }
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-screen, .cifra-container {
    animation: fadeIn 0.5s ease-out;
}

/* Scrollbar personalizada */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Estados de carregamento */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notificações do Wake Lock */
.wake-lock-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    animation: slideInRight 0.3s ease-out;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.wake-lock-notification.success {
    background: #27ae60;
}

.wake-lock-notification.error {
    background: #e74c3c;
}

.wake-lock-notification.info {
    background: #3498db;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Melhorias no botão Wake Lock */
#toggleWakeLock {
    position: relative;
}

#toggleWakeLock::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s;
}

#toggleWakeLock.active::after {
    opacity: 1;
}

/* Painel de configuração */
.config-panel {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.config-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.config-row label {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #2c3e50;
}

.config-row input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.config-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.config-hint {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

@media (max-width: 600px) {
    .config-row {
        grid-template-columns: 1fr;
    }
}

/* Songs Display Styles */
.songs-display {
    max-width: 1200px;
    margin: 0 auto;
}

.songs-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.back-to-repertorios-btn {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    text-decoration: underline;
    transition: color 0.3s;
}

.back-to-repertorios-btn:hover {
    color: #2980b9;
}

.songs-header h2 {
    color: #2c3e50;
    margin: 0.5rem 0;
    font-size: 2.5rem;
}

.repertorio-description {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
}

.songs-search-container {
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.songs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 0;
}

.song-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.song-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #3498db;
}

.song-card-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.song-card .song-icon {
    font-size: 2rem;
    color: #3498db;
}

.song-card .song-info {
    flex: 1;
}

.song-card .song-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.song-card .song-artist {
    color: #888;
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    font-weight: 400;
}

.song-card .song-tonalidade {
    background: #3498db;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Mobile Responsiveness for Songs Display */
@media (max-width: 768px) {
    .songs-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .songs-header h2 {
        font-size: 2rem;
    }
    
    .song-card {
        padding: 1rem;
    }
    
    .song-card-content {
        gap: 0.75rem;
    }
    
    .song-card .song-icon {
        font-size: 1.5rem;
    }
}

/* Mobile Responsiveness for Repertórios Main Screen */
@media (max-width: 768px) {
    .repertorios-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .repertorios-header h1 {
        font-size: 2.5rem;
    }
    
    .repertorios-header p {
        font-size: 1.1rem;
    }
    
    .repertorio-card {
        padding: 1.5rem;
    }
    
    .repertorio-card-icon {
        font-size: 2.5rem;
    }
    
    .repertorio-card-title {
        font-size: 1.3rem;
    }
}