* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --light-bg: #ecf0f1;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 40px 20px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--light-bg);
    padding: 0 20px;
    background: var(--light-bg);
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: rgba(52, 152, 219, 0.1);
    color: var(--secondary-color);
}

.tab-btn.active {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
    background: var(--white);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Timezone Selector Section */
.timezone-selector-section {
    padding: 30px 20px;
    border-bottom: 2px solid var(--light-bg);
}

.timezone-selector-section h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.5em;
}

.timezone-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.tz-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    border: 2px solid var(--light-bg);
    background: var(--white);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-dark);
}

.tz-btn i {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.tz-flag {
    font-size: 2.2em;
    margin-bottom: 8px;
    display: block;
}

.tz-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--secondary-color);
}

.tz-btn.active {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    color: var(--white);
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-lg);
}

.tz-btn.active i {
    color: var(--white);
}

/* Time Display Section */
.time-display-section {
    padding: 30px 20px;
    border-bottom: 2px solid var(--light-bg);
}

.time-display-section h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.5em;
}

.time-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.time-card {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    color: var(--white);
    padding: 12px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    text-align: center;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.time-card .tz-name {
    font-size: 0.75em;
    opacity: 0.9;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.time-card .tz-flag {
    font-size: 3em;
    margin-bottom: 12px;
    display: block;
    color: var(--white);
    line-height: 1.2;
}

.time-card .tz-abbrev-corner {
    font-size: 0.65em;
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    line-height: 1;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 4px;
    border-radius: 3px;
}

.time-card .time-display {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 2px;
    font-family: 'Courier New', monospace;
}

.time-card .date-display {
    font-size: 0.65em;
    opacity: 0.85;
}

.remove-card {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    color: var(--white);
    background: var(--secondary-color);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.remove-card:hover {
    background: var(--primary-color);
}

/* Calculator Section */
.calculator-section {
    padding: 30px 20px;
}

.calculator-section h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.5em;
}

.input-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.input-field {
    padding: 12px 15px;
    border: 2px solid var(--light-bg);
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    font-family: inherit;
}

/* ensure a multi-select doesn't collapse and shows the specified number of rows */
.input-field[multiple] {
    height: auto;
}

.input-field:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-convert {
    padding: 12px 25px;
    background: linear-gradient(135deg, var(--success-color) 0%, #229954 100%);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-convert:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.conversion-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.result-card {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-card .tz-label {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 8px;
    font-size: 0.95em;
}

.result-card .result-time {
    font-size: 1.8em;
    font-family: 'Courier New', monospace;
    color: var(--text-dark);
    font-weight: bold;
}

/* Stopwatch Styles */
.stopwatch-container {
    padding: 40px 20px;
    text-align: center;
}

.stopwatch-and-timeline {
    display: flex;
    gap: 20px;
    padding: 20px;
    align-items: flex-start;
    justify-content: space-between;
}

.timeline-container {
    flex: 1 1 480px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.timeline-container h3 {
    margin: 0 0 6px 0;
    color: var(--primary-color);
}

.timeline-container .muted {
    margin: 0 0 12px 0;
    font-size: 0.9em;
    color: #666;
}

.timeline-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.timeline-grid {
    max-height: 420px;
    overflow: auto;
    border-top: 1px solid var(--light-bg);
    padding-top: 10px;
    display: grid;
    gap: 10px;
}

.timeline-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 10px;
    align-items: center;
}

.timeline-tz {
    font-weight: 700;
    color: var(--secondary-color);
}

.timeline-hours {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 6px;
}

.timeline-hour {
    background: var(--light-bg);
    padding: 8px 6px;
    text-align: center;
    font-size: 0.9em;
    border-radius: 6px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.timeline-hour:hover,
.timeline-hour.hovered {
    border: 2px solid var(--secondary-color);
    background: rgba(52, 152, 219, 0.15);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.3);
    transform: scaleY(1.05);
}

.timeline-hour.current {
    background: linear-gradient(90deg, var(--secondary-color), #2980b9);
    color: #fff;
}

.stopwatch-display {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.stopwatch-time {
    font-size: 4em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.stopwatch-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn-stopwatch {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-stopwatch {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-stopwatch:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.btn-stopwatch:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-reset {
    background: var(--accent-color);
}

.btn-lap {
    background: var(--success-color);
}

.laps-section {
    max-width: 400px;
    margin: 0 auto;
}

.laps-list {
    text-align: left;
    display: grid;
    gap: 10px;
}

.lap-item {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--secondary-color);
}

.lap-number {
    font-weight: 600;
    color: var(--secondary-color);
    min-width: 50px;
}

.lap-time {
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-dark);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .timezone-buttons {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .time-cards {
        grid-template-columns: 1fr;
    }

    .stopwatch-time {
        font-size: 3em;
    }

    .stopwatch-buttons {
        flex-direction: column;
    }

    .btn-stopwatch {
        width: 100%;
        justify-content: center;
    }

    .input-group {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 10px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .timezone-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .time-card .time-display {
        font-size: 1.8em;
    }

    .stopwatch-time {
        font-size: 2.5em;
    }
}

/* Contact Link in Header */
.header {
    position: relative;
}

.contact-link {
    position: absolute;
    top: 20px;
    right: 20px;
    color: var(--white);
    background: rgba(0,0,0,0.2);
    padding: 8px 12px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
}

.contact-link:hover {
    background: rgba(0,0,0,0.3);
}

/* Feedback Contact Form */
#feedbackForm {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    width: 340px;
    z-index: 1000;
}

#feedbackForm h3 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
    font-size: 1.2em;
    text-align: center;
}

#feedbackForm label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9em;
}

#feedbackForm textarea,
#feedbackForm input[type="text"],
#feedbackForm input[type="email"] {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9em;
}

#feedbackForm input[type="email"] {
    background: #f5f5f5;
}

#feedbackForm input[readonly] {
    background: #f0f0f0;
    color: #666;
    cursor: not-allowed;
}

#feedbackForm button {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    width: 100%;
    font-weight: 600;
}

#feedbackForm button:hover {
    background: #2980b9;
}

/* overlay to dim background when form is active */
#feedbackOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Footer */
.footer {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    text-align: center;
    padding: 20px;
    border-top: 2px solid var(--light-bg);
    margin-top: 20px;
}

.footer p {
    margin: 0 0 15px 0;
    font-size: 0.95em;
    opacity: 0.9;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--white);
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s ease;
    opacity: 0.85;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-link-btn {
    background: none;
    border: none;
    color: var(--white);
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s ease;
    opacity: 0.85;
    cursor: pointer;
    font-family: inherit;
}

.footer-link-btn:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--white);
    padding: 40px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    margin-top: 0;
}

.modal-content p {
    color: var(--text-dark);
    line-height: 1.6;
    margin-bottom: 15px;
}

.modal-content p:last-child {
    margin-bottom: 0;
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-dark);
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--secondary-color);
}

/* Copy Link Button Styles */
.copy-link-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    gap: 10px;
}

.btn-copy-link {
    padding: 10px 20px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-copy-link:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

#copyLinkMessage {
    font-size: 14px;
    font-weight: 500;
}
