/* ============================================
   Health Tracker PWA - Dark Theme Styles
   ============================================ */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #141419;
    --bg-card: #1a1a24;
    --bg-input: #22222e;
    --text-primary: #e8e8f0;
    --text-secondary: #9090a0;
    --text-muted: #606070;
    --accent: #5b8def;
    --accent-hover: #4a7de0;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --pain-1: #4ade80;
    --pain-3: #a3e635;
    --pain-5: #fbbf24;
    --pain-7: #f97316;
    --pain-10: #ef4444;
    --border: #2a2a35;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
    padding-bottom: 80px;
}

.screen.active {
    display: block;
}

/* Auth Screen */
.auth-card {
    max-width: 360px;
    margin: 20vh auto;
    padding: 40px 24px;
    text-align: center;
}

.auth-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 15px;
}

.auth-card input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 16px;
}

.auth-card input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:active {
    background: var(--accent-hover);
}

.btn-secondary {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    cursor: pointer;
    margin-top: 8px;
}

.btn-small {
    padding: 6px 14px;
    background: var(--bg-input);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.icon-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.icon-btn:active {
    background: var(--bg-input);
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-btn {
    padding: 8px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-width: 100px;
    text-align: center;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin: 12px 16px;
    border: 1px solid var(--border);
}

.card h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2 {
    margin-bottom: 0;
}

/* Sliders */
.slider-container {
    padding: 8px 0;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    margin: 12px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(91, 141, 239, 0.4);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 4px;
}

.pain-value {
    color: var(--accent);
    font-weight: 700;
    font-size: 20px;
}

/* Item Lists */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-input);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 500;
    font-size: 15px;
}

.item-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dose-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dose-count {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
}

/* Symptom Toggle */
.symptom-toggle {
    width: 48px;
    height: 28px;
    background: var(--bg-input);
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid var(--border);
}

.symptom-toggle.active {
    background: var(--success);
}

.symptom-toggle::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.symptom-toggle.active::after {
    transform: translateX(20px);
}

/* Work Status */
.work-status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.status-btn {
    padding: 10px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.status-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Time Inputs */
.time-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.time-field label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.time-field input,
.time-field select {
    width: 100%;
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

/* Body Map */
.body-map {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
}

#body-svg {
    width: 100%;
    max-width: 200px;
    height: auto;
}

.body-zone {
    fill: var(--bg-input);
    stroke: var(--border);
    stroke-width: 1;
    cursor: pointer;
    transition: fill 0.2s;
}

.body-zone:hover {
    fill: var(--accent);
    opacity: 0.6;
}

.body-zone.pain-1 { fill: var(--pain-1); }
.body-zone.pain-2 { fill: var(--pain-3); }
.body-zone.pain-3 { fill: var(--pain-3); }
.body-zone.pain-4 { fill: var(--pain-5); }
.body-zone.pain-5 { fill: var(--pain-5); }
.body-zone.pain-6 { fill: var(--pain-7); }
.body-zone.pain-7 { fill: var(--pain-7); }
.body-zone.pain-8 { fill: var(--pain-10); }
.body-zone.pain-9 { fill: var(--pain-10); }
.body-zone.pain-10 { fill: var(--pain-10); }

.pain-legend {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* Notes */
textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    resize: vertical;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:active {
    transform: scale(0.95);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 360px;
    border: 1px solid var(--border);
}

.modal-content h3 {
    margin-bottom: 20px;
    font-size: 18px;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    margin-bottom: 12px;
}

.modal-content input:focus,
.modal-content select:focus {
    outline: none;
    border-color: var(--accent);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 300;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Message */
.message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

.message.success {
    background: rgba(74, 222, 128, 0.1);
    color: var(--success);
}

.message.error {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
}

/* Responsive */
@media (min-width: 768px) {
    .tracker-content {
        max-width: 680px;
        margin: 0 auto;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.3s ease;
}
