/* CSS Variables */
:root {
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --secondary-color: #6c757d;
    --secondary-dark: #5a6268;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --text-color: #333;
    --text-light: #666;
    --background-color: #f8f9fa;
    --border-color: #dee2e6;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Header Styles */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1rem 0 1rem; /* Remove bottom padding since nav tabs are inside */
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.app-header h1 i {
    margin-right: 0.5rem;
    color: #ff6b6b;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Day controls */
.day-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.75rem 0 1rem 0; /* Adjusted margins */
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.current-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-weight: 600;
}

#currentDateDisplay {
    font-size: 1rem;
}

.date-picker-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-picker-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.new-day-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.new-day-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

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

.sync-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.sync-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.sync-btn:active {
    transform: scale(0.95);
}

.admin-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.admin-btn:active {
    transform: scale(0.95);
}

/* Date picker modal */
.date-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.date-picker-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.date-picker-content h3 {
    margin-bottom: 1rem;
    color: #495057;
    text-align: center;
}

.date-picker-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.date-picker-input:focus {
    outline: none;
    border-color: #667eea;
}

.date-picker-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.date-picker-btn-confirm,
.date-picker-btn-cancel {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-picker-btn-confirm {
    background: #28a745;
    color: white;
}

.date-picker-btn-confirm:hover {
    background: #218838;
}

.date-picker-btn-cancel {
    background: #6c757d;
    color: white;
}

.date-picker-btn-cancel:hover {
    background: #5a6268;
}

/* Admin modal */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.admin-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
}

.admin-content h3 {
    margin-bottom: 1.5rem;
    color: #495057;
    text-align: center;
    font-size: 1.4rem;
}

.admin-options {
    margin-bottom: 2rem;
}

.admin-option {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.admin-option h4 {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1.1rem;
}

.admin-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-delete-btn,
.admin-export-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.admin-delete-btn {
    background: #dc3545;
    color: white;
}

.admin-delete-btn:hover {
    background: #c82333;
}

.admin-delete-btn.danger {
    background: #dc3545;
    color: white;
}

.admin-delete-btn.danger:hover {
    background: #c82333;
    transform: scale(1.02);
}

.admin-export-btn {
    background: #28a745;
    color: white;
}

.admin-export-btn:hover {
    background: #218838;
}

.admin-close-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.admin-close-btn:hover {
    background: #5a6268;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0 -1rem; /* Extend to full width */
    padding: 0 1rem; /* Add padding back */
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    flex: 1;
    min-width: 60px; /* Reduced minimum width */
    padding: 0.75rem 0.25rem; /* Reduced padding */
    background: none;
    border: none;
    color: #6c757d;
    font-size: 0.75rem; /* Slightly smaller font */
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem; /* Reduced gap */
    white-space: nowrap; /* Prevent text wrapping */
}

.nav-tab i {
    font-size: 1.1rem; /* Slightly smaller icons */
}

.nav-tab.active {
    color: #667eea;
    background: white;
    border-bottom: 3px solid #667eea;
}

.nav-tab:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Main Content */
.main-content {
    padding: 1rem;
    min-height: calc(100vh - 200px);
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

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

.section-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.section-header h2 {
    color: #667eea;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Pain Scale */
.pain-intensity {
    margin-bottom: 2rem;
}

.pain-intensity h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1.1rem;
}

.pain-scale {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.pain-level {
    flex: 1;
    padding: 0.75rem 0.5rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.pain-level:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.pain-level.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pain-description {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #6c757d;
}

/* Tag Grid */
.tag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.tag-btn {
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tag-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.tag-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: scale(1.02);
}

/* Meal Buttons */
.meal-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.meal-btn {
    padding: 1rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.meal-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.meal-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Meal Food Buttons */
.meal-food-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0.25rem;
}

.meal-food-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.meal-food-btn.selected {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
    transform: scale(1.02);
}

/* Ensure tag-btn selected state also works for meal food buttons */
.tag-btn.meal-food-btn.selected {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
    transform: scale(1.02);
}

/* Section Headers */
.pain-intensity h3,
.pain-location h3,
.pain-noticeability h3,
.meal-tracking h3,
.anti-inflammatory-foods h3,
.food-amount h3,
.exercise-type h3,
.exercise-location h3,
.exercise-intensity h3,
.physio-done h3,
.physio-type h3,
.sleep-position h3,
.sleep-quality h3,
.sleep-duration h3,
.meditation-done h3,
.meditation-type h3,
.meditation-duration h3 {
    color: #495057;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}



/* Data Export */
.data-export {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: calc(100% - 2rem);
    max-width: 448px;
}

.export-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(111, 66, 193, 0.3);
}

.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.4);
}

/* Main content */
.main-content {
    padding: 1rem;
    min-height: calc(100vh - 200px);
    padding-bottom: 2rem; /* Reduced padding since no save button */
}

/* Meal-specific food tracking */
.meal-food-tracking {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    border: 2px solid #667eea;
    overflow: visible;
    position: relative;
}

.meal-food-tracking .food-amount {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.meal-food-tracking .tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.meal-food-tracking h3 {
    color: #667eea;
    margin-bottom: 1rem;
    text-align: center;
}

.meal-food-tracking h4 {
    color: #495057;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* Exercise sessions */
.add-exercise {
    margin-bottom: 1.5rem;
}

.add-exercise-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
}

.add-exercise-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.4);
}

.exercise-sessions {
    margin-bottom: 2rem;
}

.exercise-session {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 2px solid #e9ecef;
    position: relative;
    transition: all 0.3s ease;
}

.exercise-session:hover {
    border-color: #667eea;
}

.exercise-session.minimized {
    padding: 0.75rem 1.5rem;
    /* Debug colors removed */
}

.exercise-session.minimized .session-content {
    display: none;
    visibility: hidden;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.exercise-session.minimized .session-header {
    margin-bottom: 0;
    border-bottom: none;
}

.exercise-session.minimized .session-header h3 {
    font-size: 1rem;
    margin: 0;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.session-header h3 {
    color: #667eea;
    font-size: 1.2rem;
    margin: 0;
}

.remove-session-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-session-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.session-time {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-time label {
    font-weight: 600;
    color: #495057;
    min-width: 60px;
}

.session-time-input {
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
}

.session-time-input:focus {
    outline: none;
    border-color: #667eea;
}

.exercise-session h4 {
    color: #495057;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* Pain entries */
.add-pain {
    margin-bottom: 1.5rem;
}

.add-pain-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.add-pain-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.pain-entries {
    margin-bottom: 2rem;
}

.pain-entry {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 2px solid #e9ecef;
    position: relative;
    transition: all 0.3s ease;
}

.pain-entry:hover {
    border-color: #dc3545;
}

.pain-entry.minimized {
    padding: 0.75rem 1.5rem;
    /* Debug colors removed */
}

.pain-entry.minimized .entry-content {
    display: none;
    visibility: hidden;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.pain-entry.minimized .entry-header {
    margin-bottom: 0;
    border-bottom: none;
}

.pain-entry.minimized .entry-header h3 {
    font-size: 1rem;
    margin: 0;
}

.entry-content {
    transition: all 0.3s ease;
}

.entry-toggle {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.entry-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #495057;
}

.entry-toggle i {
    transition: transform 0.3s ease;
}

.entry-toggle.minimized i {
    transform: rotate(-90deg);
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.entry-header h3 {
    color: #dc3545;
    font-size: 1.2rem;
    margin: 0;
}

.entry-time {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.entry-time label {
    font-weight: 600;
    color: #495057;
    min-width: 60px;
}

.entry-time-input {
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
}

.entry-time-input:focus {
    outline: none;
    border-color: #dc3545;
}

.pain-entry h4 {
    color: #495057;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* Pain summary */
.pain-summary {
    background: #e3f2fd;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    border: 2px solid #2196f3;
}

.pain-summary h3 {
    color: #1976d2;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.pain-summary-content {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Meditation sessions */
.add-meditation {
    margin-bottom: 1.5rem;
}

.add-meditation-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.3);
}

.add-meditation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(111, 66, 193, 0.4);
}

.meditation-sessions {
    margin-bottom: 2rem;
}

.meditation-session {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 2px solid #e9ecef;
    position: relative;
    transition: all 0.3s ease;
}

.meditation-session:hover {
    border-color: #667eea;
}

.meditation-session.minimized {
    padding: 0.75rem 1.5rem;
    /* Debug colors removed */
}

.meditation-session.minimized .session-content {
    display: none;
    visibility: hidden;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.meditation-session.minimized .session-header {
    margin-bottom: 0;
    border-bottom: none;
}

.meditation-session.minimized .session-header h3 {
    font-size: 1rem;
    margin: 0;
}

.session-content {
    transition: all 0.3s ease;
}

.meditation-session .session-header h3 {
    color: #667eea;
}

/* Legacy exercise section */
.legacy-exercise {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid #dee2e6;
}

.legacy-exercise h3 {
    color: #6c757d;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    text-align: center;
    font-style: italic;
}

/* Status Messages */
.status-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #28a745;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.status-message.show {
    opacity: 1;
}

.status-message.error {
    background: #dc3545;
}

/* Responsive Design */
@media (max-width: 480px) {
    .app-container {
        max-width: 100%;
        margin: 0;
    }
    
    .nav-tab {
        min-width: 50px; /* Even smaller on mobile */
        font-size: 0.7rem;
        padding: 0.6rem 0.15rem; /* Tighter padding */
    }
    
    .nav-tab i {
        font-size: 0.95rem;
    }
    
    .tag-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    
    .tag-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        min-height: 40px;
    }
    
    .pain-scale {
        gap: 0.25rem;
    }
    
    .pain-level {
        padding: 0.6rem 0.3rem;
        font-size: 0.8rem;
    }
    
    .meal-buttons {
        grid-template-columns: 1fr;
    }
    
    .quick-save,
    .data-export {
        width: calc(100% - 1rem);
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .nav-tab {
        min-width: 45px;
        font-size: 0.65rem;
        padding: 0.5rem 0.1rem;
    }
    
    .nav-tab i {
        font-size: 0.9rem;
    }
    
    .nav-tab span {
        font-size: 0.6rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus States */
.tag-btn:focus,
.pain-level:focus,
.meal-btn:focus,
.nav-tab:focus,
.save-btn:focus,
.export-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .nav-tabs,
    .quick-save,
    .data-export {
        display: none;
    }
    
    .app-container {
        box-shadow: none;
        max-width: none;
    }
    
    .content-section {
        display: block;
        page-break-inside: avoid;
    }
}

/* Header top section with user controls */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.user-section {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.user-profile-btn:hover {
    background: var(--primary-dark);
}

.login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.login-btn:hover {
    background: var(--secondary-dark);
}

/* Safari-specific fix for login button visibility */
@supports (-webkit-touch-callout: none) {
    .login-btn {
        /* Ensure the button is properly visible on Safari iOS */
        visibility: visible !important;
        opacity: 1 !important;
        /* Don't override display: none from JavaScript */
        /* This allows the JS to still hide it when user is logged in */
    }
}

/* Authentication Modal Styles */
.auth-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 1.5rem;
}

.auth-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.auth-form {
    display: none;
    border: 2px solid #ddd;
    padding: 1rem;
    margin: 1rem 0;
    background: #f9f9f9;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.auth-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    min-width: 120px;
    justify-content: center;
}

.auth-btn.primary {
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
}

.auth-btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.auth-btn.primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Profile Modal Styles */
.profile-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.profile-avatar {
    text-align: center;
    font-size: 4rem;
    color: var(--primary-color);
}

.profile-info {
    display: grid;
    gap: 1.5rem;
}

.profile-stats {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.profile-stats h4 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.profile-buttons {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    flex: 1;
}

.profile-btn.primary {
    background: var(--primary-color);
    color: white;
}

.profile-btn.primary:hover {
    background: var(--primary-dark);
}

.profile-btn.secondary {
    background: #6c757d;
    color: white;
}

.profile-btn.secondary:hover {
    background: #5a6268;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .user-section {
        justify-content: center;
    }
    
    .profile-buttons {
        flex-direction: column;
    }
    
    .form-buttons {
        flex-direction: column;
    }
}

/* Modal display styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}
