:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background-color: #f5f6fa;
    --text-color: #2c3e50;
    --border-radius: 8px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
}

h1 {
    margin-bottom: 1rem;
}

nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: background-color 0.3s;
}

.tab-btn.active {
    background-color: var(--secondary-color);
}

main {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.tab-content {
    display: none;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tab-content.active {
    display: block;
}

.time-display {
    font-size: 3rem;
    font-weight: bold;
    text-align: center;
    margin: 1rem 0;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1rem 0;
}

button {
    padding: 0.5rem 1rem;
    border: none;
    background-color: var(--secondary-color);
    color: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

.world-clocks {
    margin-top: 2rem;
}

.add-timezone {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

select, input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    flex: 1;
}

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

.timer-controls input {
    width: 80px;
    text-align: center;
}

.lap-times {
    margin-top: 1.5rem;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    background: white;
}

.lap-time {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: monospace;
}

.lap-time:last-child {
    border-bottom: none;
}

.lap-time .lap-number {
    font-weight: bold;
    color: #666;
    width: 60px;
    text-align: left;
}

.lap-time .lap-duration {
    flex-grow: 1;
    text-align: right;
}

.lap-time .total-time {
    width: 140px;
    text-align: right;
    color: #666;
}

.stopwatch-controls button {
    min-width: 80px;
}

#stopwatch-lap:disabled,
#stopwatch-reset:disabled,
#timer-reset:disabled {
    background-color: #cccccc;
    color: #666666;
    border: none;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

#stopwatch-lap:disabled:hover,
#stopwatch-reset:disabled:hover,
#timer-reset:disabled:hover {
    background-color: #cccccc;
}

.lap-times:empty {
    display: none;
}

footer {
    text-align: center;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    position: fixed;
    bottom: 0;
    width: 100%;
}

@media (max-width: 600px) {
    .time-display {
        font-size: 2rem;
    }

    .button-group {
        flex-wrap: wrap;
    }

    .timer-controls {
        flex-direction: column;
    }

    .timer-controls input {
        width: 100%;
    }
}

.timezone-selector {
    margin: 20px 0;
}

.map-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 20px;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
}

#timezone-map {
    width: 100%;
    height: 500px;
    background: #f0f0f0;
}

.timezone-region {
    fill: #e0e0e0;
    stroke: #fff;
    stroke-width: 1;
    transition: fill 0.3s;
    cursor: pointer;
}

.timezone-region:hover {
    fill: #b0b0b0;
}

.timezone-region.active {
    fill: #4CAF50;
}

.leaflet-popup-content {
    text-align: center;
    min-width: 200px;
}

@media (max-width: 600px) {
    #timezone-map {
        height: 300px;
    }
}

.leaflet-popup-content button {
    margin-top: 8px;
    padding: 4px 8px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.leaflet-popup-content button:hover {
    background: #45a049;
}

.local-clock {
    text-align: center;
    margin-bottom: 2rem;
}

.world-clock {
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    background: white;
    text-align: center;
}

.world-clock h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.world-clock .time-display {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.world-clock .date-display,
#local-date {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-align: center;
}

#local-time {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.world-clock .remove-clock {
    background: #ff4444;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
}

.world-clock .remove-clock:hover {
    background: #cc0000;
}

.timer-container,
.stopwatch-container {
    text-align: center;
    padding: 2rem;
}

.timer-controls,
.stopwatch-controls {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.timer-input-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.5rem;
}

.timer-input-group input {
    width: 60px;
    padding: 0.5rem;
    font-size: 1rem;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
}

.timer-input-group span {
    font-size: 1.2rem;
    font-weight: bold;
}

.timer-controls button,
.stopwatch-controls button {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    min-width: 80px;
}

#timer-toggle,
#stopwatch-toggle {
    background: #4CAF50;
    color: white;
}

#timer-toggle:hover,
#stopwatch-toggle:hover {
    background: #45a049;
}

#timer-toggle.active,
#stopwatch-toggle.active {
    background: #ff4444;
}

#timer-toggle.active:hover,
#stopwatch-toggle.active:hover {
    background: #cc0000;
}

#timer-reset,
#stopwatch-reset {
    background: #2196F3;
    color: white;
}

#timer-reset:hover,
#stopwatch-reset:hover {
    background: #1976D2;
}

#timer-display,
#stopwatch-display {
    font-size: 3rem;
    font-weight: bold;
    font-family: monospace;
    margin: 2rem 0;
}

#timer-display .hundredths {
    font-size: 75%;
    opacity: 0.8;
}

.countdown-container {
    padding: 20px;
    text-align: center;
}

.countdown-input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.date-input, .time-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.countdown-controls {
    display: flex;
    gap: 10px;
}

.countdown-display {
    display: flex;
    justify-content: center;
    gap: 5px;
    align-items: center;
    margin-top: 20px;
}

.countdown-display .separator {
    font-size: 3rem;
    font-weight: bold;
    margin-top: -20px; /* Adjust to align with numbers */
    color: #666;
}

.countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.countdown-unit .value {
    font-size: 3rem;
    font-weight: bold;
}

.countdown-unit .label {
    font-size: 0.9em;
    color: #666;
}

/* Update the countdown blocks to match */
.countdown-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.countdown-block .value {
    font-size: 3rem;
    font-weight: bold;
    line-height: 1;  /* Ensure consistent line height */
}

#countdown-hundredths {
    min-width: 60px;
}

#countdown-hundredths .value {
    font-size: 2.25rem; /* 75% of 3rem */
    margin-top: 0.75rem; /* Adjust to align with baseline of other numbers */
}

.countdown-block .label {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

#countdown-toggle.active {
    background-color: #ff4444;
}

#countdown-toggle:disabled,
#countdown-reset:disabled {
    background-color: #cccccc;
    color: #666666;
    border: none;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

.share-link-container {
    margin-top: 30px;
    text-align: center;
}

.share-link-box {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

#share-link {
    width: 60%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    cursor: text;
}

#copy-link {
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#copy-link:hover {
    background-color: #45a049;
}

#copy-link.copied {
    background-color: #45a049;
}
