/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #6e7cfc, #ff8e5e);
    background-size: 400% 400%;
    animation: gradientAnimation 10s ease infinite;
    padding: 20px;
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    text-align: center;
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.timer-display {
    font-size: 2.5em;
    margin-bottom: 20px;
    width: 100%;
    word-wrap: break-word;
}

.time-text {
    font-size: 3.5em;
    color: #333;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

#progress-bar-container {
    width: 100%;
    height: 10px;
    background-color: #eee;
    border-radius: 5px;
    margin-top: 10px;
}

#progress-bar {
    height: 100%;
    width: 0;
    background-color: #4CAF50;
    border-radius: 5px;
}

.inputs {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.inputs div {
    margin: 0 10px 10px 10px;
    flex-grow: 1;
    min-width: 120px;
}

input {
    width: 80px;
    padding: 10px;
    text-align: center;
    font-size: 1.5em;
    border: 2px solid #ddd;
    border-radius: 5px;
    -moz-appearance: textfield;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.buttons {
    display: flex;
    justify-content: center;
    width: 100%;
    flex-wrap: wrap;
}

.buttons button {
    padding: 15px 30px;
    font-size: 1.5em;
    margin: 10px;
    cursor: pointer;
    border: none;
    color: white;
    border-radius: 8px;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#start-btn {
    background-color: #28a745;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.3);
}

#start-btn:hover:not(:disabled) {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(40, 167, 69, 0.4);
}

#pause-btn {
    background-color: #ffc107;
    color: #333;
    box-shadow: 0 4px 10px rgba(255, 193, 7, 0.3);
}

#pause-btn:hover:not(:disabled) {
    background-color: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 193, 7, 0.4);
}

#reset-btn {
    background-color: #dc3545;
    box-shadow: 0 4px 10px rgba(220, 53, 69, 0.3);
}

#reset-btn:hover:not(:disabled) {
    background-color: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(220, 53, 69, 0.4);
}

.buttons button:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.flash {
    animation: flashAnimation 0.5s ease-in-out;
}

@keyframes flashAnimation {
    0% { color: red; }
    50% { color: #333; }
    100% { color: red; }
}

/* --- Mobile (up to 600px) --- */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
        max-width: 95%;
        border-radius: 8px;
    }

    .timer-display {
        font-size: 1.4em;
        margin-bottom: 15px;
    }

    .time-text {
        font-size: 2.8em;
    }

    .inputs {
        flex-direction: column;
        margin-bottom: 15px;
    }

    .inputs div {
        margin: 0 0 10px 0;
        width: 100%;
    }

    input {
        width: 100%;
        padding: 12px;
        font-size: 1.5em;
    }

    label {
        text-align: left;
    }

    .buttons {
        flex-direction: column;
        align-items: center;
    }

    .buttons button {
        padding: 12px 25px;
        font-size: 1.2em;
        margin: 8px 0;
        width: 90%;
        max-width: 300px;
    }

    .footer-nav a {
        margin: 0 8px;
        font-size: 0.8em;
    }

    .ad-container {
        max-width: 320px;
        min-height: 50px;
        margin: 15px 0;
    }
}

/* --- Tablet (601px to 768px) --- */
@media (min-width: 601px) and (max-width: 768px) {
    .container {
        max-width: 90%;
        padding: 25px;
    }

    .timer-display {
        font-size: 2.2em;
    }

    .time-text {
        font-size: 3em;
    }

    .inputs {
        flex-direction: row;
        justify-content: space-around;
    }

    .inputs div {
        margin: 0 10px;
    }

    input {
        width: 70px;
        font-size: 1.4em;
    }

    .buttons button {
        padding: 14px 28px;
        font-size: 1.4em;
        margin: 10px;
        width: auto;
    }
}

/* Footer and Ad Styling */
.footer-nav {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    text-align: center;
    width: 100%;
    max-width: 800px;
    color: #666;
}

.footer-nav a {
    color: #6e7cfc;
    text-decoration: none;
    margin: 0 15px;
    font-weight: bold;
    transition: color 0.3s ease;
}

.footer-nav a:hover {
    color: #ff8e5e;
}

.ad-container {
    margin: 20px 0;
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #666;
    font-size: 0.9em;
    text-align: center;
    padding: 10px;
    border-radius: 5px;
}
