/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Modal */
.modal {
    background: #2a2a2a;
    border-radius: 12px;
    width: 90vw;
    max-width: 800px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #444444;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #888888;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Modal Content */
.modal-content {
    padding: 20px;
    height: calc(100% - 80px);
    overflow: hidden;
}

/* Current Time Display */
.current-time-display {
    margin-bottom: 15px;
    text-align: center;
}

.current-time-display label {
    display: block;
    font-size: 0.9rem;
    color: #888888;
    margin-bottom: 8px;
}

.time-value {
    font-size: 1.5rem;
    font-weight: 500;
    color: #4ecdc4;
    font-variant-numeric: tabular-nums;
}

/* Time Input Section */
.time-input-section {
    margin-bottom: 15px;
}

.time-input-section label {
    display: block;
    font-size: 0.9rem;
    color: #cccccc;
    margin-bottom: 8px;
    font-weight: 500;
}

.time-input {
    width: 100%;
    padding: 12px 16px;
    background: #3a3a3a;
    border: 2px solid #555555;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1.2rem;
    font-family: inherit;
    transition: all 0.2s ease;
    font-variant-numeric: tabular-nums;
}

.time-input:focus {
    outline: none;
    border-color: #4ecdc4;
    background: #404040;
}

.time-input:invalid {
    border-color: #ff6b6b;
}

/* Preview Section */
.preview-section {
    margin-bottom: 15px;
    text-align: center;
}

.preview-section label {
    display: block;
    font-size: 0.9rem;
    color: #888888;
    margin-bottom: 8px;
}

.time-preview {
    font-size: 2rem;
    font-weight: 300;
    color: #4ecdc4;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.1em;
}

.next-day-notice {
    font-size: 0.8rem;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* Preset Section */
.preset-section {
    margin-bottom: 16px;
}

.preset-section label {
    display: block;
    font-size: 0.9rem;
    color: #cccccc;
    margin-bottom: 12px;
    font-weight: 500;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.preset-btn {
    padding: 10px 16px;
    background: #4a4a4a;
    border: 1px solid #666666;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    font-variant-numeric: tabular-nums;
}

.preset-btn:hover {
    background: #555555;
    border-color: #4ecdc4;
}

.preset-btn:active,
.preset-btn.selected {
    background: #4ecdc4;
    border-color: #4ecdc4;
    color: #1a1a1a;
}

/* Modal Buttons */
.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4ecdc4;
    color: #1a1a1a;
}

.btn-primary:hover:not(:disabled) {
    background: #45b7aa;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: #cccccc;
    border: 2px solid #666666;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #888888;
}

.btn-danger {
    background: #ff4757;
    color: white;
    border: 2px solid #ff4757;
}

.btn-danger:hover {
    background: #ff3742;
    border-color: #ff3742;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .modal {
        width: 95vw;
        max-width: none;
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-content {
        padding: 16px;
        flex-direction: column !important;
        gap: 20px !important;
    }
    
    .ad-container {
        flex: none !important;
        width: 100% !important;
    }
    
    .preset-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .preset-btn {
        padding: 12px 16px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .time-preview {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .time-input {
        font-size: 1.1rem;
    }
    
    .time-preview {
        font-size: 1.6rem;
    }
}

/* Focus styles for accessibility */
.time-input:focus,
.preset-btn:focus,
.btn:focus,
.close-btn:focus {
    outline: 2px solid #4ecdc4;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .modal {
        border: 2px solid #ffffff;
    }
    
    .time-input {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal {
        transition: none;
    }
}