/* css styles */ 

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background: #0f172a;
    color: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Fixes top cut-off on iPhone */
    padding: 40px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 600px;
    padding: 0 15px;
    box-sizing: border-box;
    margin: 0 auto;
}

.timer-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

.bath-icon { font-size: 3rem; margin-bottom: 10px; }
h2 { margin: 0 0 20px 0; color: #38bdf8; font-weight: 500; letter-spacing: 0.5px;}

/* 
 * CRITICAL FIX: The wrapper for the numbers. 
 * This ensures they sit nicely in a row and wrap cleanly on small screens. 
 */
.countdown-row {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 8px;
    flex-wrap: wrap; 
    margin-bottom: 20px;
}

/* 
 * CRITICAL FIX: Strict styling so blocks stay as neat little squares 
 * and never expand into huge rows.
 */
.time-block {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 8px;
    min-width: 55px; /* Firmly sets them as squares */
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.time-block span { 
    font-size: 1.5rem; 
    font-weight: bold; 
    color: #f1f5f9; 
    font-family: 'Courier New', Courier, monospace;
}
.time-block label { 
    font-size: 0.65rem; 
    color: #94a3b8; 
    text-transform: uppercase; 
    margin-top: 5px; 
    letter-spacing: 1px;
}

.time-block.highlight-ms { min-width: 70px; }
.time-block.highlight-ms span { color: #38bdf8; }

.time-block.highlight-ns { min-width: 100px; }
.time-block.highlight-ns span { color: #06b6d4; font-size: 1.3rem; }

#status-text { color: #94a3b8; font-size: 0.9rem; margin-bottom: 15px; }

.action-row {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.control-panel {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 20px;
    padding: 25px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.tab-btn {
    flex: 1;
    background: #334155;
    color: #94a3b8;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}

.tab-btn.active { background: #38bdf8; color: #0f172a; }

.panel-content h3 { margin: 0 0 15px 0; font-size: 1.1rem; color: #cbd5e1; }
.panel-content h3.edit-highlight { color: #fbbf24; }

.input-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.75rem; color: #94a3b8; }

input[type="number"], input[type="time"] {
    background: #0f172a;
    border: 1px solid #475569;
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
input:disabled { opacity: 0.4; }

button.btn-primary {
    width: 100%;
    background: #0284c7;
    color: #fff;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}
button.btn-primary:hover { background: #0369a1; }
button.btn-primary.edit-mode { background: #d97706; }
button.btn-primary.edit-mode:hover { background: #b45309; }

button.btn-danger, button.btn-warning {
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
}
button.btn-danger { background: #ef4444; }
button.btn-danger:hover { background: #dc2626; }
button.btn-warning { background: #f59e0b; color: #0f172a; }
button.btn-warning:hover { background: #d97706; }

.days-picker {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    background: #0f172a;
    padding: 12px;
    border-radius: 10px;
}

.days-picker label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-weight: bold;
    cursor: pointer;
}

.time-picker-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.hidden { display: none !important; }

/* Mobile Formatting for iPhone */
@media(max-width: 480px) { 
    body { padding: 20px 0; }
    
    /* Forces the inputs into a single column so they don't get squished */
    .input-grid { 
        grid-template-columns: 1fr; 
        gap: 12px;
    }
    
    /* Allows the numbers to squeeze slightly together on tiny phone screens */
    .countdown-row { gap: 5px; }
    .time-block { min-width: 45px; padding: 8px 2px; }
    .time-block span { font-size: 1.2rem; }
    .time-block.highlight-ms { min-width: 60px; }
    .time-block.highlight-ns { min-width: 80px; }
    
    .days-picker { flex-wrap: wrap; justify-content: center; gap: 10px; }
    .bath-icon { font-size: 2.2rem; }
}
