/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #333333;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --local-hand-color: #000000;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Container */
.container {
    width: 100%;
    overflow-x: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px 20px;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 10;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Main Content Layout */
.main-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    position: relative;
    min-height: 100vh;
}

.main-content.panel-visible .clock-section {
    transform: translateX(calc(-235px - 30px));
}

/* Clock Section */
.clock-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    z-index: 10;
}

.clock-container {
    background: var(--card-background);
    border-radius: 50%;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
    cursor: pointer;
    user-select: none;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clock-container:hover {
    box-shadow: var(--shadow-hover);
}

#clockCanvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.local-time-display {
    margin-top: 30px;
    text-align: center;
    font-size: 1.2rem;
    display: none;
}

.local-time-label {
    color: var(--text-muted);
    margin-right: 10px;
}

.digital-time {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* Timezone Panel */
.timezone-panel {
    background: var(--card-background);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: 700px;
    width: 350px;
    flex-shrink: 0;
    position: absolute;
    left: 50%;
    margin-left: 30px;
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.6s;
    pointer-events: none;
    visibility: hidden;
    z-index: 1;
}

.timezone-panel.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s;
}

.panel-header h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

/* Add Timezone Section */
.add-timezone-section {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.timezone-select {
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    background: white;
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.timezone-select:focus {
    outline: none;
    border-color: var(--secondary-color);
}

/* Button Styles */
.btn {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    line-height: 1;
    min-width: 32px;
}

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

.btn-primary:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    padding: 2px 6px;
    font-size: 0.7rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Color Picker */
.color-picker {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    outline: 2px solid var(--border-color);
    outline-offset: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-picker::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-picker:focus {
    outline: 2px solid var(--border-color);
    outline-offset: 0;
}

/* Timezone List */
.timezone-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    padding-right: 10px;
    margin-right: -10px;
}

.timezone-item {
    background: var(--background-color);
    border-radius: 4px;
    padding: 3px 6px;
    margin-bottom: 3px;
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 6px;
    align-items: center;
    transition: all 0.3s ease;
}

.timezone-city {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
}

.timezone-city-input {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 2px 4px;
    transition: all 0.2s ease;
    width: 100%;
}

.timezone-city-input:hover {
    border-color: var(--border-color);
    background: white;
}

.timezone-city-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: white;
}

.color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.timezone-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
}

.timezone-time-input {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 2px 4px;
    transition: all 0.2s ease;
    min-width: 50px;
}

.timezone-time-input:hover {
    border-color: var(--border-color);
    background: white;
}

.timezone-time-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: white;
}

.btn-pin {
    background: transparent;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.btn-pin:hover {
    opacity: 0.8;
}

.btn-pin.active {
    opacity: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state.hidden {
    display: none;
}

.empty-state p {
    margin-bottom: 10px;
}

.empty-state-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .timezone-panel {
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .main-content {
        gap: 20px;
    }

    .clock-container {
        padding: 15px;
    }

    .timezone-panel {
        padding: 20px;
    }

    .add-timezone-section {
        flex-direction: column;
    }

    .timezone-select {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .clock-container {
        padding: 10px;
    }

    .timezone-panel {
        padding: 15px;
    }

    .timezone-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Scrollbar Styling */
.timezone-list::-webkit-scrollbar {
    width: 8px;
}

.timezone-list::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 4px;
}

.timezone-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.timezone-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Time Markers Section */
.time-markers-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid var(--border-color);
}

.time-markers-section h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.add-marker-section {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.time-input,
.marker-desc-input {
    padding: 4px 8px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    transition: border-color 0.3s ease;
}

.time-input {
    flex: 0 0 auto;
    min-width: 90px;
}

.marker-desc-input {
    flex: 1;
    min-width: 0;
}

.time-input:focus,
.marker-desc-input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.marker-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-right: 10px;
    margin-right: -10px;
}

.marker-item {
    background: var(--background-color);
    border-radius: 4px;
    padding: 3px 6px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 6px;
    align-items: center;
    transition: all 0.3s ease;
}

.marker-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
}
