/* styles.css */
:root {
    /* Color Palette */
    --bg-base: #0d0e12;           /* Deep dark background */
    --bg-card: #181920;           /* Slightly lighter for cards */
    --bg-input: #23252f;          /* Input fields background */
    --border-subtle: #2d2f3a;     /* Soft borders */
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Accents (Premium Gradients & Colors) */
    --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6); /* Deep blue to purple */
    --accent-glow: rgba(139, 92, 246, 0.4);
    --oracle-gradient: linear-gradient(135deg, #10b981, #0ea5e9); /* Elegant teal/emerald to blue */
    --danger-color: #ef4444;
    
    /* Layout */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --transition: cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    height: 100vh;
    height: 100dvh; /* For accurate mobile viewport height */
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 500px; /* limits width on desktop/tablets */
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background-color: var(--bg-base);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

/* HEADER */
header {
    padding: 28px 24px 20px;
    background: var(--bg-base); 
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-primary);
}

.logo-icon {
    stroke: #8b5cf6;
}

/* MAIN CONTENT AREA */
main {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 24px;
    padding-bottom: 120px; /* Space for fixed bottom nav */
}

/* Hide scrollbars for a clean app feel */
main::-webkit-scrollbar { display: none; }
main { -ms-overflow-style: none; scrollbar-width: none; }

.view {
    display: none;
    animation: fadeScale 0.3s var(--transition) forwards;
    opacity: 0;
}

.view.active {
    display: block;
}

@keyframes fadeScale {
    0% { opacity: 0; transform: translateY(15px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* CARDS */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 24px;
}

.card-transparent {
    padding: 0;
    margin-bottom: 24px;
}

.spacer {
    height: 16px;
}

.section-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* INPUTS & SELECTS (The Fix) */
.clean-input, select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 16px 20px;
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    transition: box-shadow var(--transition), border-color var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

.clean-input::placeholder {
    color: var(--text-muted);
}

.clean-input:focus, select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Ensure standard input visual cues */
.clean-input {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

/* Hide bulky spin arrows on number inputs */
.clean-input[type="number"]::-webkit-inner-spin-button, 
.clean-input[type="number"]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}

/* Custom Select styling */
.custom-select-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.custom-select-wrapper select {
    margin-bottom: 0;
    padding-right: 48px;
    cursor: pointer;
}

.custom-select-wrapper::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
}

/* Forms layout */
.input-group {
    display: flex;
    gap: 16px;
}

.input-group .input-field {
    flex: 1;
}

/* BUTTONS */
button {
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: transform 0.1s, box-shadow var(--transition);
}

button:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 8px 24px var(--accent-glow);
    margin-top: 8px;
}

.btn-primary:hover {
    box-shadow: 0 12px 32px var(--accent-glow);
}

.btn-secondary {
    background-color: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    padding: 10px 16px;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    width: auto;
    font-weight: 500;
}

/* LISTS (Exercises & History) */
.list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list li {
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-subtle);
}

.list li .details h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-weight: 500;
}

.list li .details p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.list li .badge {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Highlight the latest history entry */
.list li.highlight-latest {
    border-left: 4px solid #8b5cf6;
    background-color: rgba(139, 92, 246, 0.05);
}

/* BOTTOM NAV */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(13, 14, 18, 0.85); /* Slightly transparent base */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    justify-content: space-around;
    padding: 16px 8px 32px; /* Generous bottom padding for iOS home indicator */
    border-top: 1px solid var(--border-subtle);
    z-index: 10;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 8px;
    width: 30%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-radius: 0;
    cursor: pointer;
}

/* Fix iOS bug where clicking an SVG swallows the click event */
.nav-btn * {
    pointer-events: none;
}

.nav-btn svg {
    width: 24px;
    height: 24px;
    opacity: 0.7;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-btn.active {
    color: #fff;
}

.nav-btn.active svg {
    opacity: 1;
    transform: translateY(-4px) scale(1.1);
    stroke: #8b5cf6; /* Match primary accent */
}

/* Utility Messages */
.success-msg {
    color: #34d399; /* Green success */
    text-align: center;
    margin-top: 16px;
    font-weight: 500;
    font-size: 0.95rem;
    min-height: 1.2em;
    opacity: 0;
    transition: opacity 0.3s;
}

.success-msg.show {
    opacity: 1;
}
