:root {
    --color-bg: #f8fbfb;
    --color-surface: #ffffff;
    --color-text-main: #2d3748;
    --color-text-muted: #718096;
    
    /* Calming Medical / Support Palette */
    --color-primary: #319795;
    --color-primary-light: #e6fffa;
    --color-secondary: #3182ce;
    --color-secondary-light: #ebf8ff;
    --color-accent: #805ad5;
    --color-accent-light: #faf5ff;
    --color-success: #38a169;
    --color-success-light: #f0fff4;
    --color-warning: #d69e2e;
    --color-warning-light: #fffff0;
    --color-info: #dd6b20;
    --color-info-light: #fffaf0;

    --color-border: #e2e8f0;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme {
    --color-bg: #1a202c;
    --color-surface: #2d3748;
    --color-text-main: #edf2f7;
    --color-text-muted: #a0aec0;
    --color-border: #4a5568;
    --color-primary-light: #234e52;
    --color-secondary-light: #2b6cb0;
    --color-accent-light: #553c9a;
    --color-success-light: #22543d;
    --color-warning-light: #5f370e;
    --color-info-light: #7b341e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.6;
    font-size: 1.05rem; /* Accessibility: Larger base font */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--color-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-brand {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeInDown 1.2s ease-out;
}

.splash-title {
    font-family: 'Inter', sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    color: #1A365D;
    letter-spacing: -0.5px;
    margin-bottom: 0.4rem;
}

body.dark-theme .splash-title {
    color: #90cdf4;
}

.splash-plus {
    color: #319795;
    font-weight: 800;
    font-size: 2.6rem;
}

.splash-tagline {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 300;
    color: #718096;
    letter-spacing: 4px;
    text-transform: uppercase;
}

body.dark-theme .splash-tagline {
    color: #a0aec0;
}

@keyframes fadeInDown {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.breathing-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--color-primary-light) 0%, var(--color-primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(49, 151, 149, 0.4);
    animation: breathe 8s infinite ease-in-out;
    margin-bottom: 2rem;
}

.breathing-text {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
}

.splash-subtitle {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    text-align: center;
    max-width: 80%;
    margin-bottom: 3rem;
}

.skip-btn {
    background: none;
    border: 1px solid var(--color-border);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.skip-btn:hover {
    background-color: var(--color-surface);
    color: var(--color-text-main);
}

@keyframes breathe {
    0% { transform: scale(0.8); box-shadow: 0 0 10px rgba(49, 151, 149, 0.2); }
    50% { transform: scale(1.3); box-shadow: 0 0 40px rgba(49, 151, 149, 0.6); }
    100% { transform: scale(0.8); box-shadow: 0 0 10px rgba(49, 151, 149, 0.2); }
}

/* Header */
.app-header {
    background-color: var(--color-surface);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.header-title-container h1 {
    pointer-events: auto;
}

.back-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    margin-right: 0.5rem;
}

.back-btn:hover {
    background-color: var(--color-primary-light);
}

.back-btn svg {
    width: 24px;
    height: 24px;
}

.back-btn.hidden {
    visibility: hidden; /* Keep layout balanced */
}

.info-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    margin-left: 0.5rem;
}

.info-btn:hover {
    background-color: var(--color-primary-light);
}

.info-btn svg {
    width: 24px;
    height: 24px;
}

.hidden {
    display: none !important;
}

.app-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1A365D; /* Navy Blue to match logo */
    margin: 0;
    flex-grow: 1;
    text-align: center;
    letter-spacing: -0.2px;
}

body.dark-theme .app-title {
    color: #90cdf4;
}

/* Content Area */
.app-content {
    flex-grow: 1;
    padding: 1.5rem 1rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

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

/* Footer */
.app-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* Home View */
.welcome-section {
    text-align: center;
    margin-bottom: 2rem;
}

.welcome-section h2 {
    font-size: 1.75rem;
    color: var(--color-text-main);
    margin-bottom: 0.5rem;
}

.welcome-section p {
    color: var(--color-text-muted);
}

.categories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.category-card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.category-card:hover, .category-card:active {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-light);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem auto;
    transition: var(--transition);
}

.card-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    transition: var(--transition);
}

.category-card:hover .card-icon {
    transform: scale(1.1);
}

.category-card h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--color-text-main);
}

.category-card p {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Generic View Headers */
.view-header {
    margin-bottom: 1.5rem;
}

.view-header h2 {
    color: var(--color-primary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.view-header p {
    color: var(--color-text-muted);
}

/* Info Lists & Cards */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--color-primary);
}

.info-card.highlight-accent {
    border-left-color: var(--color-accent);
}

.info-card.highlight-primary {
    border-left-color: var(--color-primary);
}

.info-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-main);
}

.info-card p, .info-card li {
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

.info-card ul {
    margin-left: 1.25rem;
    margin-top: 0.5rem;
}

.info-card li {
    margin-bottom: 0.5rem;
}

/* Checklists */
.checklist-section h3 {
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.1rem;
    color: var(--color-secondary);
}

.checklist {
    list-style: none;
    background: var(--color-surface);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.checklist li {
    border-bottom: 1px solid var(--color-border);
}

.checklist li:last-child {
    border-bottom: none;
}

.checklist label {
    display: flex;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.checklist label:hover {
    background-color: var(--color-bg);
}

.checklist input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    margin-right: 1rem;
    display: grid;
    place-content: center;
    transition: var(--transition);
    cursor: pointer;
}

.checklist input[type="checkbox"]::before {
    content: "";
    width: 14px;
    height: 14px;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em white;
    background-color: white;
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.checklist input[type="checkbox"]:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.checklist input[type="checkbox"]:checked::before {
    transform: scale(1);
}

.checklist input[type="checkbox"]:checked + span,
.checklist label:has(input:checked) {
    color: var(--color-text-muted);
    text-decoration: line-through;
    opacity: 0.8;
}

/* Contacts */
.contact-card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.contact-name {
    font-weight: 500;
}

.contact-number a {
    display: inline-block;
    background-color: var(--color-success-light);
    color: var(--color-success);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.contact-number a:hover {
    background-color: var(--color-success);
    color: white;
}

.custom-notes {
    margin-top: 1.5rem;
}

.notes-area {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: var(--transition);
}

.notes-area:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Carousel for Psychological Support */
.carousel-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1rem;
    padding-bottom: 1.5rem; /* space for scrollbar */
    -ms-overflow-style: none; /* IE/Edge */
    scrollbar-width: none; /* Firefox */
}
.carousel-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.carousel-card {
    flex: 0 0 85%;
    scroll-snap-align: center;
    background: linear-gradient(135deg, var(--color-secondary-light), var(--color-surface));
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-secondary-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 200px;
}
.carousel-card h4 {
    color: var(--color-secondary);
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.spiritual-card {
    background: linear-gradient(135deg, #faf5ff, var(--color-surface));
    border-color: #faf5ff;
}
.spiritual-card h4 {
    color: #805ad5;
}

/* 3-Step Infographic Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 1rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    height: 100%;
    width: 2px;
    background-color: var(--color-border);
}
.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}
.timeline-item:last-child {
    margin-bottom: 0;
}
.timeline-number {
    position: absolute;
    left: -2rem;
    top: 0;
    width: 24px;
    height: 24px;
    background-color: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    transform: translateX(-50%);
    box-shadow: 0 0 0 4px var(--color-bg);
}
.timeline-content {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}
.timeline-content h4 {
    color: var(--color-text-main);
    margin-bottom: 0.5rem;
}

/* Full Monthly Calendar */
.calendar-container {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.cal-nav-btn {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.cal-nav-btn:hover {
    background: var(--color-primary);
    color: white;
}

#calendar-month-year {
    font-size: 1.1rem;
    color: var(--color-text-main);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    user-select: none;
}

.calendar-day:hover:not(.empty) {
    background-color: var(--color-secondary-light);
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day.today {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: bold;
}

.calendar-day.selected {
    background-color: var(--color-primary);
    color: white;
    font-weight: bold;
}

.calendar-day.has-notes::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--color-accent);
}

.calendar-day.selected.has-notes::after {
    background-color: white;
}

@media (max-width: 480px) {
    .categories-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 2rem 1rem;
    box-sizing: border-box;
}

.modal-overlay.hidden-modal {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 90%;
    width: 500px;
    position: relative;
    box-shadow: var(--shadow-lg);
    transform: translateY(0);
    transition: transform 0.3s ease;
    margin: auto;
}

.modal-overlay.hidden-modal .modal-content {
    transform: translateY(20px);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close-btn:hover {
    background-color: var(--color-bg);
    color: var(--color-text-main);
}

/* Dark Theme Custom Overrides */
body.dark-theme svg circle[stroke="#1A365D"] {
    stroke: #90cdf4 !important;
}
body.dark-theme .app-header svg circle[stroke="#1A365D"] {
    stroke: #90cdf4 !important;
}
body.dark-theme .app-title {
    color: #90cdf4 !important;
}
body.dark-theme #splash-screen {
    background-color: var(--color-bg);
}
body.dark-theme #splash-screen svg circle[stroke="#1A365D"] {
    stroke: #90cdf4 !important;
}
body.dark-theme #splash-screen .breathing-text {
    background: rgba(45, 55, 72, 0.9);
    color: var(--color-primary);
}
body.dark-theme .theme-btn:hover {
    background-color: var(--color-primary-light);
}

/* Reminders & Medication Component Styling */
.reminder-card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--color-warning);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.reminder-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.reminder-time-badge {
    display: inline-block;
    background-color: var(--color-warning-light);
    color: var(--color-warning);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    width: fit-content;
}

body.dark-theme .reminder-time-badge {
    background-color: #5f370e;
    color: #f6ad55;
}

.reminder-delete-btn {
    background: none;
    border: none;
    color: #e53e3e;
    cursor: pointer;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.reminder-delete-btn:hover {
    background-color: #fff5f5;
}

body.dark-theme .reminder-delete-btn:hover {
    background-color: #feb2b220;
}

/* ==========================================
   Premium Welcome Card (Mimicking user's card)
   ========================================== */
.welcome-card {
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    border-radius: var(--border-radius);
    padding: 2.2rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

body.dark-theme .welcome-card {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border: 1px solid rgba(74, 85, 104, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.welcome-card-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

/* Adapt SVG strokes in dark mode */
body.dark-theme .welcome-card-logo svg path:not(.animated-heart) {
    stroke: #edf2f7 !important;
}

.welcome-card-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: #2c3e50;
    letter-spacing: 1.5px;
    margin: 0.5rem 0 0.2rem 0 !important;
}

body.dark-theme .welcome-card-title {
    color: #edf2f7;
}

.welcome-card-subtitle {
    font-family: 'Playfair Display', 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: #718096;
    margin: 0 !important;
    letter-spacing: 0.5px;
}

body.dark-theme .welcome-card-subtitle {
    color: #a0aec0;
}

/* Animations for Logo to make it feel alive (micro-animations) */
@keyframes heartPulse {
    0% { transform: scale(1); transform-origin: 100px 85px; }
    50% { transform: scale(1.08); transform-origin: 100px 85px; }
    100% { transform: scale(1); transform-origin: 100px 85px; }
}

.animated-heart {
    animation: heartPulse 3s infinite ease-in-out;
}

@keyframes haloBreathe {
    0% { opacity: 0.5; stroke-dashoffset: 0; }
    50% { opacity: 0.85; stroke-dashoffset: 5; }
    100% { opacity: 0.5; stroke-dashoffset: 0; }
}

.animated-halo {
    animation: haloBreathe 4s infinite ease-in-out;
}

@keyframes handGentlySwayLeft {
    0% { transform: rotate(0deg); transform-origin: 76px 169px; }
    50% { transform: rotate(-2deg); transform-origin: 76px 169px; }
    100% { transform: rotate(0deg); transform-origin: 76px 169px; }
}

@keyframes handGentlySwayRight {
    0% { transform: rotate(0deg); transform-origin: 124px 169px; }
    50% { transform: rotate(2deg); transform-origin: 124px 169px; }
    100% { transform: rotate(0deg); transform-origin: 124px 169px; }
}

.animated-hand-left {
    animation: handGentlySwayLeft 5s infinite ease-in-out;
}

.animated-hand-right {
    animation: handGentlySwayRight 5s infinite ease-in-out;
}

/* ==========================================
   SOS / Emergency Widget
   ========================================== */
.emergency-widget {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border-radius: var(--border-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-left: 5px solid #e53e3e;
    border-top: 1px solid #feb2b2;
    border-right: 1px solid #feb2b2;
    border-bottom: 1px solid #feb2b2;
    transition: var(--transition);
}

.emergency-widget:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.emergency-widget-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.emergency-widget-icon {
    font-size: 2.2rem;
    animation: pulseRed 2s infinite ease-in-out;
}

.emergency-widget-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #9b2c2c;
    margin: 0 0 0.1rem 0;
}

.emergency-widget-info p {
    font-size: 0.85rem;
    color: #c53030;
    margin: 0;
}

.emergency-widget-btn {
    background-color: #e53e3e;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 4px 6px rgba(229, 62, 62, 0.2);
}

.emergency-widget-btn:hover {
    background-color: #c53030;
    transform: scale(1.05);
}

@keyframes pulseRed {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); filter: drop-shadow(0 0 6px rgba(229, 62, 62, 0.5)); }
    100% { transform: scale(1); }
}

/* Dark Theme Overrides for Emergency Widget */
body.dark-theme .emergency-widget {
    background: linear-gradient(135deg, #7b341e 0%, #2d3748 100%) !important;
    border-color: #7b341e !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

body.dark-theme .emergency-widget-info h3 {
    color: #fed7d7 !important;
}

body.dark-theme .emergency-widget-info p {
    color: #fbd38d !important;
}

/* ==========================================
   Save Indicator & Backup/Restore Panel
   ========================================== */
.save-indicator {
    text-align: right;
    font-size: 0.85rem;
    color: var(--color-success);
    margin-top: 0.35rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-weight: 600;
}

.backup-panel {
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    margin-top: 2rem;
    transition: var(--transition);
}

.backup-panel:hover {
    box-shadow: var(--shadow-md);
}

.backup-panel h3 {
    font-size: 1.15rem;
    color: var(--color-text-main);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.backup-panel p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.backup-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.btn-backup-export, .btn-backup-import {
    flex: 1;
    min-width: 140px;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-backup-export {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.btn-backup-export:hover {
    background-color: var(--color-primary);
    color: white;
}

.btn-backup-import {
    background-color: var(--color-secondary-light);
    color: var(--color-secondary);
}

.btn-backup-import:hover {
    background-color: var(--color-secondary);
    color: white;
}

@media (max-width: 480px) {
    .emergency-widget {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.2rem;
        gap: 0.8rem;
    }
    
    .emergency-widget-btn {
        width: 100%;
        text-align: center;
    }
}

/* Floating SOS Panic Button styling */
.sos-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    border: 2px solid white;
    color: white;
    font-size: 1.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4);
    z-index: 999;
    transition: var(--transition);
    animation: pulseRedFloating 2s infinite ease-in-out;
}

.sos-floating-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 62, 62, 0.5);
}

@keyframes pulseRedFloating {
    0% { transform: scale(1); box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4); }
    50% { transform: scale(1.08); box-shadow: 0 6px 25px rgba(229, 62, 62, 0.6); }
    100% { transform: scale(1); box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4); }
}

body.dark-theme .sos-floating-btn {
    border-color: #4a5568;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Responsiveness overrides for Mobile Header */
@media (max-width: 480px) {
    .app-title {
        font-size: 1.15rem !important;
    }
}

/* SOS Modal Emergency Call Buttons */
.emergency-call-btn:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}
