@import url('https://fonts.googleapis.com/css2?family=Jamjuree:wght@400;600;700&display=swap');

:root {
    --primary-color: #6c5ce7;
    --primary-dark: #5649c0;
    --secondary-color: #00cec9;
    --dark-color: #2d3436;
    --light-color: #f5f6fa;
    --gray-color: #636e72;
    --success-color: #00b894;
    --danger-color: #d63031;
    --warning-color: #fdcb6e;
    --work-color: #ff7675;
    --break-color: #55efc4;
    --long-break-color: #74b9ff;
}

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

body {
    background-color: #f9f9f9;
    color: var(--dark-color);
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

header h1 span {
    color: var(--primary-color);
}

header p {
    color: var(--gray-color);
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.timer-container, .tasks-container {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.timer-display {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    /* เพิ่ม cursor และ transition สำหรับ modal */
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.timer-display:hover {
    transform: scale(1.03); /* ขยายเล็กน้อยเมื่อเมาส์ชี้ */
}

.time {
    position: absolute;
    font-size: 3.5rem;
    font-weight: bold;
    color: var(--dark-color);
    z-index: 2;
    margin-top: -10px;
}

.progress-ring__circle {
    stroke: var(--primary-color);
    transition: stroke-dashoffset 0.5s;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--light-color);
    color: var(--dark-color);
}

.btn-secondary:hover {
    background-color: #e1e2e8;
}

.timer-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.setting {
    margin-bottom: 1rem;
}

.setting label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-color);
}

.setting input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: 'Jamjuree', sans-serif;
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tasks-header h2 {
    color: var(--dark-color);
}

.pomodoro-count {
    background-color: var(--light-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
}

.task-input {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.task-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    transition: border 0.3s;
    font-family: 'Jamjuree', sans-serif;
}

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

.task-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--gray-color);
    font-weight: 600;
    border-radius: 5px;
    transition: all 0.3s;
}

.filter-btn.active {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.filter-btn:hover:not(.active) {
    color: var(--dark-color);
}

.task-list {
    list-style: none;
    margin-bottom: 1.5rem;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: var(--light-color);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
}

.task-item:hover {
    transform: translateX(5px);
}

.task-checkbox {
    margin-right: 1rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.task-text {
    flex: 1;
    word-break: break-word;
}

.task-text.completed {
    text-decoration: line-through;
    color: var(--gray-color);
}

.task-pomodoro-count {
    background-color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 1rem;
}

.task-actions {
    margin-left: 1rem;
    display: flex;
    gap: 0.5rem;
}

.task-actions button {
    background: none;
    border: none;
    color: var(--gray-color);
    cursor: pointer;
    transition: color 0.3s;
}

.task-actions button:hover {
    color: var(--danger-color);
}

.task-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--gray-color);
}

.task-stats button {
    background: none;
    border: none;
    color: var(--gray-color);
    cursor: pointer;
    transition: color 0.3s;
}

.task-stats button:hover {
    color: var(--danger-color);
}

.notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--dark-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

.notification.show {
    opacity: 1;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
    
    .timer-controls {
        flex-direction: column;
    }
    
    .timer-settings {
        grid-template-columns: 1fr;
    }
}

/* Animation classes */
.pulse {
    animation: pulse 1.5s infinite;
}

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

/* ========== สไตล์สำหรับ Modal ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* ทำให้มืดลงเพื่อโฟกัส */
    display: none; /* ซ่อนไว้เป็นค่าเริ่มต้น */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex; /* แสดงเมื่อมีคลาส .show */
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 3rem;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

/* ขยายขนาดนาฬิกา เมื่ออยู่ใน Modal */
#modalTimerPlaceholder .timer-display {
    transform: scale(1.5); /* ขยาย 1.5 เท่า */
    cursor: default; /* เปลี่ยน cursor กลับเป็นปกติ */
}

/* ปรับขนาดสำหรับมือถือ */
@media (max-width: 768px) {
    #modalTimerPlaceholder .timer-display {
        transform: scale(1.2); /* ลดขนาดลงเล็กน้อยในมือถือ */
    }
}