:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg: #F3F4F6;
    --card-bg: #FFFFFF;
    --text: #1F2937;
    --text-light: #6B7280;
    --danger: #EF4444;
    --success: #10B981;
    --success-hover: #059669;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; /* Roboto é a fonte nativa do Android */
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0; /* Removemos o padding para colar nas bordas do celular */
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove aquele piscar azul ao clicar no celular */
}

.app-layout {
    display: flex; gap: 2rem; width: 100%; max-width: 950px; align-items: flex-start;
    padding: 2rem; /* Mantém o espaçamento só para quem abrir no PC */
}

/* Coluna Principal */
.container {
    background-color: var(--card-bg); padding: 2rem; border-radius: 12px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); flex: 1; min-width: 320px;
}

/* Coluna Lateral */
.sidebar {
    background-color: var(--card-bg); padding: 1.5rem; border-radius: 12px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); width: 320px; min-width: 280px; display: flex; flex-direction: column; gap: 1.5rem;
}

h1, h3 { text-align: center; margin-top: 0; color: var(--text); }

.scoreboard {
    background-color: var(--primary); color: white; padding: 1.5rem; border-radius: 12px; text-align: center; margin-bottom: 2rem; transition: background-color 0.3s;
}
.scoreboard.overtime { background-color: var(--danger); }
.scoreboard h2 { margin: 0.5rem 0 0 0; font-size: 3rem; font-weight: 700; }
.scoreboard p { margin: 0; font-size: 1rem; opacity: 0.9; text-transform: uppercase; letter-spacing: 1px; }

.warning { color: #FEE2E2; font-size: 0.85rem; margin-top: 0.5rem; font-weight: bold; display: none; }

/* Estilos de Botão Minimalista para Adicionar */
.btn-minimalist {
    width: 100%; padding: 1rem; background: transparent; border: 2px dashed #D1D5DB; border-radius: 8px; color: var(--text-light); font-weight: bold; font-size: 1rem; cursor: pointer; transition: all 0.2s; margin-bottom: 1.5rem;
}
.btn-minimalist:hover { border-color: var(--primary); color: var(--primary); background: #EEF2FF; }

.input-group {
    display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; background: #F9FAFB; padding: 1.5rem; border-radius: 8px; border: 1px solid #E5E7EB;
}

.time-inputs { display: flex; gap: 1rem; }

input {
    padding: 0.75rem; border: 1px solid #D1D5DB; border-radius: 6px; font-size: 1rem; width: 100%; box-sizing: border-box; outline: none; transition: border-color 0.2s;
}
input:focus { border-color: var(--primary); }

.action-buttons { display: flex; gap: 0.5rem; }

button {
    border: none; padding: 0.85rem; border-radius: 6px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: background-color 0.2s; width: 100%; color: white;
}
.btn-add { background-color: var(--primary); }
.btn-add:hover { background-color: var(--primary-hover); }

.btn-cancel { background-color: #E5E7EB; color: var(--text); }
.btn-cancel:hover { background-color: #D1D5DB; }

.btn-finish { background-color: var(--success); margin-top: 1rem; display: none; }
.btn-finish:hover { background-color: var(--success-hover); }

ul { list-style-type: none; padding: 0 5px 0 0; margin: 0; max-height: 250px; overflow-y: auto; overflow-x: hidden; }
li { background-color: #FFFFFF; border-bottom: 1px solid #E5E7EB; padding: 1rem 0; display: flex; justify-content: space-between; align-items: center; }
li:last-child { border-bottom: none; }

.task-name { font-weight: 600; color: var(--text); flex-grow: 1; margin-right: 1rem; }
.task-actions { display: flex; align-items: center; gap: 10px; padding-right: 4px; }
.task-time { background-color: #E0E7FF; color: var(--primary); padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.85rem; font-weight: bold; white-space: nowrap; }

.icon-btn {
    background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 0.2rem; opacity: 0.6; transition: opacity 0.2s, transform 0.2s; width: auto; color: initial;
}
.icon-btn:hover { opacity: 1; transform: scale(1.1); }

/* Estilos do Histórico */
.sidebar-section { background: #F9FAFB; padding: 1rem; border-radius: 8px; border: 1px solid #E5E7EB; flex: 1; }
.sidebar-section h3 { font-size: 1.1rem; margin-bottom: 1rem; border-bottom: 2px solid #E5E7EB; padding-bottom: 0.5rem; }
.day-item { display: flex; justify-content: space-between; align-items: center; background: white; padding: 0.75rem; border-radius: 6px; margin-bottom: 0.5rem; border: 1px solid #E5E7EB; font-size: 0.9rem; font-weight: 600; }

/* Estilos do Acordeão */
.month-group { margin-bottom: 0.5rem; }
.month-header {
    display: flex; justify-content: space-between; align-items: center; background: #E5E7EB; padding: 0.5rem 0.75rem; border-radius: 6px; font-weight: bold; font-size: 0.95rem; cursor: pointer; user-select: none; transition: background 0.2s; color: var(--text);
}
.month-header:hover { background: #D1D5DB; }
.month-content { padding: 0.5rem 0 0 0.5rem; }

/* Modais */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000;
}
.modal-content {
    background: var(--card-bg); padding: 2rem; border-radius: 12px; width: 100%; max-width: 420px; max-height: 85vh; display: flex; flex-direction: column; overflow-y: auto;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; border-bottom: 1px solid #E5E7EB; padding-bottom: 1rem;
}
.modal-header h2 { margin: 0; font-size: 1.3rem;}
.close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); width: auto; padding: 0; }
.modal-body ul { max-height: 250px; }

#modalEditSection { padding: 1rem; margin-bottom: 1rem; }

/* Ajuste do contêiner do Gráfico */
.chart-container { position: relative; height: 250px; width: 100%; margin-top: 1rem; }

@media (max-width: 768px) {
    .app-layout { 
        flex-direction: column; 
        padding: 0; /* Tira as bordas na tela do celular */
        gap: 0;
    }
    
    .container, .sidebar { 
        width: 100%; 
        border-radius: 0; /* Tira cantos arredondados */
        box-shadow: none; /* Tira a sombra */
        padding: 1.5rem 1rem;
        box-sizing: border-box;
    }

    /* Transforma o H1 numa AppBar do Android */
    h1 {
        background-color: var(--primary);
        color: white;
        margin: -1.5rem -1rem 1.5rem -1rem; /* Estica até as bordas */
        padding: 1.2rem;
        font-size: 1.2rem;
        text-align: left;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    /* Ajuste para o botão da Sidebar ficar visível */
    .sidebar-section h3 {
        margin-top: 0;
    }
    
    /* Aumenta a área de toque dos botões (Regra de UX Mobile) */
    button, input {
        min-height: 48px; 
    }
    .icon-btn {
        padding: 0.5rem;
    }
}

/* Estilo do botão de adicionar no cabeçalho do Modal (igual ao X) */
.btn-square-add {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    transition: color 0.2s, transform 0.2s;
}

.btn-square-add:hover {
    color: var(--primary); /* Fica azulzinho só quando passa o mouse */
    transform: scale(1.1);
}