/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #000;
    color: #fff;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Dialog Styles */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dialog-content {
    background-color: #1a1a1a;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    border: 2px solid #333;
}

.dialog-content h2 {
    color: #00ff88;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.tip-type-selection {
    margin-bottom: 1.5rem;
}

.tip-type-selection label {
    display: block;
    margin: 0.8rem 0;
    padding: 0.8rem;
    background-color: #2a2a2a;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
    border: 2px solid transparent;
}

.tip-type-selection label:hover {
    background-color: #3a3a3a;
}

.tip-type-selection input[type="radio"] {
    margin-right: 0.8rem;
    transform: scale(1.2);
}

.tip-type-selection input[type="radio"]:checked + span {
    color: #00ff88;
    font-weight: bold;
}

.tip-type-selection label:has(input:checked) {
    border-color: #00ff88;
    background-color: #1a3a2a;
}

.tip-input-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

#tipValue {
    background-color: #2a2a2a;
    border: 2px solid #444;
    color: #fff;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1.2rem;
    text-align: center;
    width: 150px;
    margin-right: 0.5rem;
}

#tipValue:focus {
    outline: none;
    border-color: #00ff88;
}

#tipUnit {
    font-size: 1.5rem;
    color: #00ff88;
    font-weight: bold;
}

.service-time-container {
    margin-bottom: 1.5rem;
}

.service-time-container label {
    display: block;
    color: #00ff88;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

#serviceTime {
    background-color: #2a2a2a;
    border: 2px solid #444;
    color: #fff;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1.2rem;
    text-align: center;
    width: 100%;
}

#serviceTime:focus {
    outline: none;
    border-color: #00ff88;
}

.btn-primary {
    background: linear-gradient(45deg, #00ff88, #00cc6a);
    color: #000;
    border: none;
    padding: 1rem 2rem;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* App Container */
.app-container {
    min-height: 100vh;
    padding: 1rem;
    max-width: 480px;
    margin: 0 auto;
}

.app-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 20px;
    border: 2px solid #333;
}

.app-header h1 {
    color: #00ff88;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.tip-display {
    font-size: 2rem;
    font-weight: bold;
    color: #00ff88;
}

/* Phase Indicators */
.phase-indicators {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.phase {
    background-color: #1a1a1a;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #333;
    transition: all 0.3s;
}

.phase.active {
    border-color: #00ff88;
    background-color: #1a3a2a;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.phase h3 {
    color: #00ff88;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.timer {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.btn-phase {
    background-color: #2a2a2a;
    color: #fff;
    border: 2px solid #444;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-phase:hover:not(:disabled) {
    background-color: #3a3a3a;
    border-color: #00ff88;
}

.btn-phase:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-phase:not(:disabled):active {
    transform: scale(0.98);
}

/* Main Timer Container */
.main-timer-container {
    text-align: center;
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 20px;
    border: 2px solid #333;
}

.main-timer {
    margin-bottom: 2rem;
}

.timer-value {
    font-size: 4rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px currentColor;
    transition: all 0.3s;
}

.timer-label {
    font-size: 1.2rem;
    color: #ccc;
}

.service-progress {
    margin-top: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #333;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #ffaa00, #ff4444);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.time-info {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    color: #ccc;
    font-family: 'Courier New', monospace;
}

#timeElapsed {
    color: #00ff88;
    font-weight: bold;
}

#timeLimit {
    color: #666;
}

.btn-meal-served {
    background: linear-gradient(45deg, #ff4444, #cc0000);
    color: #fff;
    border: none;
    padding: 1.2rem 2rem;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-meal-served:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 68, 68, 0.3);
}

.btn-meal-served:active {
    transform: translateY(0);
}

/* Results Summary */
.results-summary {
    background-color: #1a1a1a;
    padding: 2rem;
    border-radius: 20px;
    border: 2px solid #333;
    margin-top: 2rem;
}

.results-summary h3 {
    color: #00ff88;
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid #333;
    font-size: 1.1rem;
}

.result-item.total {
    border-top: 2px solid #00ff88;
    margin-top: 1rem;
    padding-top: 1rem;
    font-weight: bold;
    font-size: 1.3rem;
    color: #00ff88;
}

/* Color States */
.tip-high {
    color: #00ff88 !important;
}

.tip-medium {
    color: #ffaa00 !important;
}

.tip-low {
    color: #ff6600 !important;
}

.tip-none {
    color: #ff0000 !important;
    animation: flash 1s infinite;
}

@keyframes flash {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* Responsive Design for iPhone */
@media screen and (max-width: 480px) {
    .app-container {
        padding: 0.5rem;
    }
    
    .dialog-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .timer-value {
        font-size: 3rem;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .tip-display {
        font-size: 1.5rem;
    }
}

/* iPhone X and newer safe area support */
@supports (padding: max(0px)) {
    .app-container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}
