:root {
    --bg-color: #ffedeb;
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --primary-color: #ff6b81;
    --hover-color: #ff4757;
    --phase-color: #ff4757;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.6s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

#mode-selector {
    padding: 12px;
    border-radius: 10px;
    border: 2px solid var(--primary-color);
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#cycle-counter {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 600;
}

.timer-card {
    background-color: var(--card-bg);
    padding: 40px 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: box-shadow 0.3s ease;
}

#phase-title {
    font-size: 1.2rem;
    color: var(--phase-color);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: color 0.6s ease;
}

.time-display {
    font-size: 5rem;
    font-weight: 800;
    margin: 20px 0;
    font-variant-numeric: tabular-nums;
    color: var(--text-color);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    background-color: var(--primary-color);
    color: white;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

button:active {
    transform: scale(0.95);
}

button:hover {
    background-color: var(--hover-color);
}

#btn-pause, #btn-reset {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

#btn-pause:hover, #btn-reset:hover {
    background-color: var(--primary-color);
    color: white;
}

.task-section {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.task-header h3 {
    font-size: 1.1rem;
}

.task-actions {
    display: flex;
    gap: 8px;
}

.task-actions button {
    padding: 6px 12px;
    font-size: 0.8rem;
    background-color: #f1f2f6;
    color: var(--text-color);
    border: 1px solid #dfe4ea;
}

.task-actions button:hover {
    background-color: #dfe4ea;
}

.task-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#task-input {
    flex: 1;
    min-width: 0;
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

#task-input:focus {
    border-color: var(--primary-color);
}

#btn-add-task {
    padding: 0 20px;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.task-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px;
}

.task-list::-webkit-scrollbar { width: 6px; }
.task-list::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.task-list::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 10px; }

.task-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: opacity 0.3s ease;
}

.task-item.completed span {
    text-decoration: line-through;
    opacity: 0.5;
}

.task-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
}

.task-item span {
    flex: 1;
    word-break: break-word;
    font-size: 0.95rem;
}

.delete-task {
    background: none;
    color: #ff4757;
    border: none;
    padding: 5px;
    font-size: 1.2rem;
    cursor: pointer;
}
.delete-task:hover { background: none; color: #c0392b; transform: scale(1.1); }

/* Modal de Histórico */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal.hidden .modal-content {
    transform: translateY(20px);
}

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

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--text-color);
}

.close-btn {
    background: none;
    color: var(--text-color);
    font-size: 1.5rem;
    padding: 0;
    width: 30px; height: 30px;
    display: flex; justify-content: center; align-items: center;
}
.close-btn:hover { background: #f1f2f6; }

.history-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: flex-end;
    background: #f1f2f6;
    padding: 10px;
    border-radius: 10px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.filter-group label {
    font-size: 0.8rem;
    margin-bottom: 4px;
    font-weight: 600;
    color: #555;
}

.filter-group input {
    padding: 8px;
    border: 1px solid #dfe4ea;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
}

.filter-group input:focus {
    border-color: var(--primary-color);
}

#btn-clear-filter {
    padding: 8px 12px;
    font-size: 0.9rem;
    background-color: white;
    color: #ff4757;
    border: 1px solid #dfe4ea;
}

#btn-clear-filter:hover {
    background-color: #ffedeb;
    border-color: #ff6b81;
}

.history-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.history-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }

.history-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.history-item:last-child { border-bottom: none; }
.history-item strong { display: block; font-size: 0.95rem; margin-bottom: 4px;}
.history-item small { color: #888; font-size: 0.8rem; }
.history-empty { text-align: center; color: #888; padding: 20px 0; font-size: 0.9rem;}

@media (max-width: 480px) {
    .time-display { font-size: 4rem; }
    .controls button { flex: 1; padding: 12px 10px; font-size: 0.9rem; }
    .task-section { padding: 20px 15px; }
    .task-input-group { gap: 8px; }
    #btn-add-task { padding: 0 15px; }
    .task-actions button { padding: 6px 8px; font-size: 0.75rem; }
    .history-filters { flex-wrap: wrap; }
    #btn-clear-filter { flex: 1; }
}