/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 헤더 */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

/* 헤더 컨트롤 */
.header-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header-controls .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* 메인 콘텐츠 */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

/* 현재 시간 섹션 */
.current-time-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.clock-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.digital-clock {
    text-align: center;
}

.time-display {
    font-size: 4rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    font-family: 'Courier New', monospace;
}

.date-display {
    font-size: 1.5rem;
    color: #666;
    font-weight: 300;
}

.time-sync-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 0.9rem;
    margin-top: 15px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    flex-wrap: wrap;
}

.sync-text {
    flex: 1;
    min-width: 0;
}

.time-sync-status .btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.time-sync-checking {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.time-sync-synced {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.time-sync-offline {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
    border: 1px solid rgba(108, 117, 125, 0.3);
}

.time-sync-error {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.time-sync-unknown {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

/* 광고 섹션 */
.ad-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    margin-bottom: 30px;
    text-align: center;
    overflow: hidden;
}

.ad-section iframe,
.ad-section div {
    max-width: 100%;
    margin: 0 auto;
}

/* 세계 시계 섹션 */
.world-clock-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.world-clock-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 2rem;
}

/* 도시 선택 컨트롤 */
.city-controls {
    margin-bottom: 30px;
    text-align: center;
}

.city-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.city-selector select {
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 1rem;
    background: white;
    min-width: 200px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.city-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.city-selector select option {
    padding: 10px;
}

.world-clocks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.world-clock-item {
    background: linear-gradient(135deg, #e8f4fd 0%, #f0f8ff 100%);
    color: #333;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 1px solid #d1e7dd;
    position: relative;
    transition: transform 0.3s ease;
}

.world-clock-item:hover {
    transform: translateY(-2px);
}

.world-clock-item h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.world-clock-time {
    font-size: 1.8rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.world-clock-date {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 5px;
}

.world-clock-offset {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 3px;
    font-weight: bold;
}

.world-clock-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.world-clock-remove:hover {
    background: rgba(220, 53, 69, 1);
}

.world-clock-dst-info {
    font-size: 0.7rem;
    margin-top: 5px;
    padding: 2px 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    color: #667eea;
    font-weight: 500;
}

/* 타이머 섹션 */
.timer-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.timer-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 2rem;
}

.timer-controls {
    text-align: center;
}

.timer-display {
    font-size: 3rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 30px;
    font-family: 'Courier New', monospace;
}

.timer-buttons {
    margin-bottom: 30px;
}

.timer-input {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.timer-input input {
    width: 80px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 10px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.timer-input span {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

/* 스톱워치 섹션 */
.stopwatch-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.stopwatch-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 2rem;
}

.stopwatch-controls {
    text-align: center;
}

.stopwatch-display {
    font-size: 3rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 30px;
    font-family: 'Courier New', monospace;
}

.stopwatch-buttons {
    margin-bottom: 30px;
}

.lap-times {
    max-height: 200px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.lap-time-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-family: 'Courier New', monospace;
}

.lap-time-item:last-child {
    border-bottom: none;
}

/* 버튼 스타일 */
.btn {
    padding: 12px 24px;
    margin: 0 10px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    color: #333;
}

.btn-danger {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 푸터 */
.footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .time-display {
        font-size: 2.5rem;
    }
    
    .timer-display,
    .stopwatch-display {
        font-size: 2rem;
    }
    
    .world-clocks {
        grid-template-columns: 1fr;
    }
    
    .timer-input {
        flex-wrap: wrap;
    }
    
    .timer-input input {
        width: 60px;
        font-size: 1rem;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        margin: 5px;
    }
}

@media (max-width: 480px) {
    .time-display {
        font-size: 2rem;
    }
    
    .timer-display,
    .stopwatch-display {
        font-size: 1.8rem;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* 애니메이션 */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.time-display {
    animation: pulse 2s infinite;
}

/* 스크롤바 스타일링 */
.lap-times::-webkit-scrollbar {
    width: 8px;
}

.lap-times::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.lap-times::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.lap-times::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    margin: 2% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 30px;
}

.help-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.help-section h4 {
    color: #555;
    margin: 20px 0 10px 0;
    font-size: 1rem;
}

.help-section ul {
    margin: 0;
    padding-left: 20px;
}

.help-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.help-section strong {
    color: #667eea;
}

.sync-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.local-time-info {
    background: #fff3cd;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #ffc107;
    margin-top: 15px;
}

.local-time-info h4 {
    color: #856404;
    margin: 0 0 15px 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.local-time-info ul {
    margin: 0;
    padding-left: 20px;
}

.local-time-info li {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #856404;
}

.local-time-info strong {
    color: #6c5a00;
}

.status-synced {
    color: #28a745;
    font-weight: bold;
}

.status-checking {
    color: #ffc107;
    font-weight: bold;
}

.status-offline {
    color: #6c757d;
    font-weight: bold;
}

.status-error {
    color: #dc3545;
    font-weight: bold;
}

/* 반응형 모달 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .header-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .time-sync-status {
        flex-direction: column;
        gap: 10px;
    }
    
    .sync-text {
        order: 1;
    }
    
    .time-sync-status .btn-sm {
        order: 2;
        width: 100%;
        max-width: 150px;
    }
    
    .ad-section {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .ad-section iframe,
    .ad-section div {
        max-width: 100%;
        height: auto;
    }
}
