:root {
    --bg-color: #F8F9FA;
    --text-color: #212529;
    --primary-color: #007bff;
    --primary-hover-color: #0056b3;
    --progress-bar-bg: #E9ECEF;
    --progress-bar-fill: var(--primary-color);
    --modal-bg: #FFFFFF;
}

[data-theme="dark"] {
    --bg-color: #212529;
    --text-color: #F8F9FA;
    --primary-color: #4DABF7;
    --primary-hover-color: #1C7ED6;
    --progress-bar-bg: #343A40;
    --modal-bg: #343A40;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    width: 90%;
    max-width: 500px;
    text-align: center;
    padding: 20px;
}

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

header h1 {
    font-size: 2rem;
}

/* Theme Switcher */
.theme-switcher {
    position: relative;
}

#theme-toggle {
    display: none;
}

#theme-toggle + label {
    display: flex;
    align-items: center;
    cursor: pointer;
    background-color: var(--progress-bar-bg);
    border-radius: 50px;
    padding: 5px;
    width: 60px;
    height: 30px;
    position: relative;
    transition: background-color 0.3s;
}

#theme-toggle + label .sun,
#theme-toggle + label .moon {
    font-size: 1rem;
    transition: opacity 0.3s, transform 0.3s;
}

#theme-toggle + label::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--bg-color);
    left: 5px;
    transition: transform 0.3s;
}

#theme-toggle:checked + label::before {
    transform: translateX(30px);
}

#theme-toggle:checked + label .sun {
    opacity: 0;
}

#theme-toggle:not(:checked) + label .moon {
    opacity: 0;
}


/* Timer */
.timer-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto 40px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    transition: stroke-dashoffset 1s linear;
    stroke: var(--progress-bar-fill);
    stroke-linecap: round;
}

.timer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#mode-display {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

#time-display {
    font-size: 4.5rem;
    font-weight: 200;
}

#session-display {
    font-size: 1rem;
    margin-top: 10px;
}

/* Controls */
.controls button {
    font-size: 1.2rem;
    padding: 10px 30px;
    margin: 0 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: var(--primary-color);
    color: white;
    transition: background-color 0.3s;
}

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

/* Timer Section */
.timer-section {
    margin-bottom: 60px;
}

/* Content Section (AdSense Optimization) */
.content-section {
    text-align: left;
    line-height: 1.6;
    border-top: 1px solid var(--progress-bar-bg);
    padding-top: 40px;
    margin-top: 20px;
}

.content-section article {
    margin-bottom: 30px;
}

.content-section h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.content-section p, .content-section li {
    font-size: 1rem;
    margin-bottom: 10px;
}

.content-section ul, .content-section ol {
    padding-left: 20px;
}

/* Footer & Stats */
footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--progress-bar-bg);
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.footer-bottom {
    font-size: 0.9rem;
    color: #666;
}

[data-theme="dark"] .footer-bottom {
    color: #aaa;
}

.footer-bottom nav {
    margin-bottom: 10px;
}

.footer-bottom a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 5px;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

footer button {
    background: none;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

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


/* Settings Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--modal-bg);
    margin: 15% auto;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 400px;
    position: relative;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--text-color);
}

.setting {
    margin: 15px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting input {
    width: 60px;
    padding: 5px;
    border-radius: 5px;
    border: 1px solid var(--text-color);
    background-color: var(--bg-color);
    color: var(--text-color);
}

#save-settings-btn {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#save-settings-btn:hover {
    background-color: var(--primary-hover-color);
}

/* Ad Placeholder */
.ad-placeholder {
    margin: 20px auto;
    width: 100%;
    max-width: 728px; /* Example width */
    height: 90px; /* Example height */
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px dashed #ccc;
}

/* Responsive Design */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.5rem;
    }
    .timer-container {
        width: 250px;
        height: 250px;
    }
    #time-display {
        font-size: 3.5rem;
    }
    .controls button {
        padding: 10px 20px;
    }
}
