/* CSS Variables for Light/Dark Mode */
:root {
    --bg-body: #c9c5ba;
    --bg-container: white;
    --bg-header: #8b7b8a;
    --bg-nav: #f8f9fa;
    --bg-content: white;
    --bg-card: white;
    --text-primary: #333;
    --text-secondary: #666;
    --text-light: #999;
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    --shadow-color: rgba(0,0,0,0.3);
    --input-bg: white;
    --input-border: #ddd;
    --modal-overlay: rgba(0,0,0,0.5);
}

body.dark-mode {
    --bg-body: #1a1a1a;
    --bg-container: #2d2d2d;
    --bg-header: #8b7b8a;
    --bg-nav: #3a3a3a;
    --bg-content: #252525;
    --bg-card: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-light: #808080;
    --border-color: #444;
    --border-light: #555;
    --shadow-color: rgba(0,0,0,0.6);
    --input-bg: #3a3a3a;
    --input-border: #555;
    --modal-overlay: rgba(0,0,0,0.7);
}

.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'liga';
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-body);
    min-height: 100vh;
    padding: 10px;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-container);
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--shadow-color);
    overflow: hidden;
}

.header {
    background: var(--bg-header);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.nav-tabs {
    display: flex;
    background: var(--bg-nav);
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.nav-tab {
    padding: 15px 30px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 16px;
    color: var(--text-primary);
    white-space: nowrap;
    transition: background 0.3s ease;
}

.nav-tab:hover {
    background: var(--border-light);
}

.nav-tab.active {
    background: var(--bg-container);
    border-bottom: 3px solid #8b7b8a;
    color: #8e8a9f;
    font-weight: bold;
}

/* Calendar tab padding restored */
@media (min-width: 769px) {
    .nav-tab:first-child {
        padding-left: 30px;
    }
}

.content {
    padding: 20px;
    background: var(--bg-content);
    font-size: 16px;
    line-height: 1.6;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* Add padding to specific content containers that don't have their own inner containers */
#dayView,
#appointmentsContent,
#notesContent,
#galleryContent,
#medicationsContent,
#dietContent,
#graphsContent,
#pets,
#settings {
    padding: 20px 15px;
}

.pet-selector {
    display: flex;
    gap: 15px;
    margin: 5px 0;
    padding: 10px 20px;
    align-items: center;
    justify-content: flex-start;
    background: white;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.pet-selector::-webkit-scrollbar {
    height: 6px;
}

.pet-selector::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.pet-selector::-webkit-scrollbar-thumb {
    background: #8b7b8a;
    border-radius: 3px;
}

.pet-selector::-webkit-scrollbar-thumb:hover {
    background: #6d5e6c;
}

/* Center pets when they fit on screen */
@supports (width: fit-content) {
    .pet-selector {
        width: fit-content;
        max-width: 100%;
        margin: 5px auto;
    }
}

.pet-card {
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.5;
    transform: scale(0.85);
}

.pet-card:hover {
    border-color: #8e8a9f;
    transform: scale(0.9);
    opacity: 0.7;
}

.pet-card.active {
    border-color: #8e8a9f;
    background: #8e8a9f;
    color: white;
    opacity: 1;
    transform: scale(1);
}

.pet-photo-small {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #e9ecef;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: #8e8a9f;
    color: white;
}

.btn-primary:hover {
    background: #7d7990;
    transform: translateY(-2px);
}

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

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

.calendar {
    background: white;
    border-radius: 10px;
    padding: 20px;
    width: 100%;
    overflow-x: auto;
}

@media (min-width: 769px) {
    .calendar {
        padding-left: 10px;
    }
}

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

.calendar-header h2 {
    font-size: 24px;
    color: var(--text-primary);
}

.calendar-nav {
    display: flex;
    gap: 10px;
}

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

.calendar-day-header {
    text-align: center;
    font-weight: bold;
    padding: 10px;
    color: #8e8a9f;
}

.calendar-day {
    min-height: 100px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.calendar-day:hover {
    border-color: #8e8a9f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(142, 138, 159, 0.2);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.today {
    border-color: #8e8a9f;
    background: #f0eff3;
}

.day-number {
    font-weight: bold;
    margin-bottom: 5px;
}

.day-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.day-icon {
    font-size: 18px;
    color: #8b7b8a;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #8e8a9f;
}

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

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay);
    z-index: 1000;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-container);
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Welcome Modal Styles */
.welcome-modal-content {
    background: var(--bg-container);
    border-radius: 15px;
    padding: 40px 30px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    border: 4px solid #8e8a9f;
    position: relative;
}

.welcome-icon {
    font-size: 80px !important;
    color: #8e8a9f;
    margin-bottom: 20px;
}

.welcome-modal-content h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 24px;
}

.welcome-modal-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Step dots */
.welcome-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.welcome-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-light);
    transition: background 0.3s, transform 0.3s;
}

.welcome-step-dot.active {
    background: #8e8a9f;
    transform: scale(1.2);
}

/* Slides */
.welcome-slide {
    display: none;
}

.welcome-slide.active {
    display: block;
    animation: welcomeFadeIn 0.3s ease;
}

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

/* Feature list */
.welcome-features {
    text-align: left;
    margin: 15px 0;
}

.welcome-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.welcome-feature-item .material-icons {
    font-size: 24px;
    margin-top: 2px;
    flex-shrink: 0;
}

.welcome-feature-item span {
    font-size: 13px;
    color: var(--text-secondary);
}

.welcome-backup-reminder {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    color: #856404;
    text-align: left;
}

.welcome-backup-reminder > strong {
    display: block;
    margin-bottom: 5px;
}

.welcome-btn {
    background: #8e8a9f;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
}

.welcome-btn:hover {
    background: #6c757d;
}

/* Did You Know tip */
.welcome-tip {
    background: #f0f0f0;
    border: none;
    border-radius: 10px;
    padding: 18px 20px;
    margin: 15px 0;
    text-align: left;
}

body.dark-mode .welcome-tip {
    background: #3a3a3a;
}

.welcome-tip-label {
    font-weight: 700;
    color: #8e8a9f;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
}

.welcome-tip-text {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
    transition: opacity 0.15s ease;
}

.welcome-tip-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.welcome-tip-chevron {
    background: none;
    border: 1.5px solid #8e8a9f;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #8e8a9f;
    padding: 0;
    transition: background 0.2s, color 0.2s;
}

.welcome-tip-chevron:hover {
    background: #8e8a9f;
    color: white;
}

.welcome-tip-chevron .material-icons {
    font-size: 20px;
}

/* Dark Mode Compatible Styles */
input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
input[type="time"],
select,
textarea {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--input-border);
}

.view h2,
.view h3 {
    color: var(--text-primary);
}

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

.entry-section {
    border-color: var(--border-light);
}

.calendar-day {
    background: var(--bg-container);
    border-color: var(--border-light);
    color: var(--text-primary);
}

body.dark-mode .calendar-day {
    background: #3a3a3a;
    border-color: #555;
}

body.dark-mode .calendar-day.today {
    border-color: #8e8a9f;
    background: rgba(142, 138, 159, 0.2);
}

body.dark-mode .calendar {
    background: #3a3a3a;
    border: 2px solid #e0e0e0;
}

body.dark-mode .pet-profile {
    border-bottom-color: var(--border-color);
}

body.dark-mode .modal-content,
body.dark-mode .welcome-modal-content {
    color: var(--text-primary);
}

body.dark-mode .welcome-backup-reminder {
    background: #3d3520;
    border-color: #8a7530;
    color: #e0c860;
}

/* Specific calendar dates - repeat options styling */
.repeat-options-box {
    background: #f8f9fa;
}
.calculated-dates-box {
    background: white;
}

/* Days of week checklist layout */
.days-checklist {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 280px;
}
.day-check-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}
.day-check-row:hover {
    background: rgba(139, 123, 138, 0.08);
}
.day-check-row span {
    font-size: 15px;
}
.day-check-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    cursor: pointer;
}
body.dark-mode .day-check-row:hover {
    background: rgba(255, 255, 255, 0.06);
}
body.dark-mode .repeat-options-box {
    background: var(--bg-card);
}
body.dark-mode .calculated-dates-box {
    background: var(--bg-content);
    color: var(--text-primary);
}
body.dark-mode .calculated-dates-box strong {
    color: var(--text-primary);
}
body.dark-mode .calculated-dates-box div {
    color: var(--text-secondary) !important;
}

body.dark-mode .welcome-feature-item {
    border-bottom-color: var(--border-light);
}

/* Dark mode pet selector */
body.dark-mode .pet-selector {
    background: transparent;
}

body.dark-mode .pet-card {
    background: #3a3a3a;
    border-color: #555;
}

body.dark-mode .pet-card:hover {
    background: #454545;
}

body.dark-mode .pet-card.active {
    background: #4a4a4a;
    border-color: #8e8a9f;
}

/* Dark mode medication/treatment/diet cards */
body.dark-mode .medication-item,
body.dark-mode .diet-item,
body.dark-mode .treatment-item,
body.dark-mode .supplement-item,
body.dark-mode .med-item {
    background: #3a3a3a;
    border-left-color: #e0e0e0;
}

/* Dark mode card headers - match entry section style */
body.dark-mode .med-item h4 {
    color: #a89fb5;
}

/* Dark mode card text - lighter than default */
body.dark-mode .med-item p,
body.dark-mode .med-item strong {
    color: #b0b0b0;
}

/* ===== Reusable Card Components ===== */
.card {
    background: #f0eff3;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #a294a1;
    margin-bottom: 15px;
}

.card h3,
.card h4 {
    color: var(--text-primary);
}

.card p {
    color: var(--text-secondary);
}

.stat-container {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.stat-card {
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 6px;
}

.stat-card h4 {
    color: var(--text-primary);
}

.stat-card p {
    color: var(--text-secondary);
}

.photo-card {
    position: relative;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.photo-card-label {
    padding: 10px;
    background: white;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.storage-container {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.storage-stat-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid;
    color: var(--text-primary);
}

.storage-stat-card p {
    color: var(--text-secondary);
}

.photo-mgmt-card {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    background: white;
    color: var(--text-secondary);
}

/* ===== Dark Mode - Card Components ===== */
body.dark-mode .card {
    background: #3a3a3a;
    border-left-color: #e0e0e0;
}

body.dark-mode .card h3,
body.dark-mode .card h4 {
    color: #a89fb5;
}

body.dark-mode .card p,
body.dark-mode .card strong {
    color: #b0b0b0;
}

body.dark-mode .stat-container {
    background: #2d2d2d;
    border: 2px solid #e0e0e0;
}

body.dark-mode .stat-card {
    background: #3a3a3a;
}

body.dark-mode .stat-card h4 {
    color: #a89fb5;
}

body.dark-mode .stat-card p,
body.dark-mode .stat-card strong {
    color: #b0b0b0;
}

body.dark-mode .photo-card {
    background: #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .photo-card-label {
    background: #e0e0e0;
    color: #333;
}

body.dark-mode .storage-container {
    background: transparent;
    border: none;
}

body.dark-mode .storage-container h3,
body.dark-mode .storage-container h4 {
    color: #a89fb5;
}

body.dark-mode .storage-container p {
    color: #b0b0b0;
}

body.dark-mode .storage-stat-card {
    background: #2d2d2d;
}

body.dark-mode .photo-mgmt-card {
    background: #3a3a3a;
    border: 2px solid #555;
}

body.dark-mode .photo-mgmt-card h4,
body.dark-mode .photo-mgmt-card p {
    color: #b0b0b0;
}

/* Dark mode entry sections */
body.dark-mode .entry-section {
    border-color: var(--border-color);
}

.pet-profile {
    text-align: center;
    padding: 30px;
    border-bottom: 2px solid #e9ecef;
}

.pet-profile:last-child {
    border-bottom: none;
}

.pet-profile-info {
    text-align: left;
    max-width: 500px;
    margin: 20px auto;
}

/* Desktop layout for pet profile */
@media (min-width: 769px) {
    .pet-profile {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding-left: 50px;
    }
    
    .pet-profile-container {
        display: flex;
        gap: 30px;
        align-items: flex-start;
        max-width: 900px;
        margin: 0 0 30px 0;
    }
    
    .pet-profile-photo-wrapper {
        flex-shrink: 0;
    }
    
    .pet-profile-info {
        flex: 1;
        text-align: left;
        max-width: none;
        margin: 0;
    }
    
    .pet-profile-name {
        text-align: center;
        margin-bottom: 20px;
        align-self: center;
        width: 100%;
    }
    
    .pet-profile-buttons {
        align-self: center;
        width: 100%;
    }
}

.pet-profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 20px;
    display: block;
    border: 5px solid #8e8a9f;
    background: #e9ecef;
}

/* Desktop: tall rectangle photo like export report */
@media (min-width: 769px) {
    .pet-profile-photo {
        width: 200px;
        height: 300px;
        border-radius: 10px;
        margin: 0;
    }
}

.day-entry-form {
    background: var(--bg-nav);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.entry-section {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.entry-section h3 {
    color: #8e8a9f;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.entry-section p {
    line-height: 1.6;
    margin-bottom: 8px;
}

.entry-section ol {
    padding-left: 25px;
}

.slider-container {
    margin: 20px 0;
    border: none;
    padding: 0;
}

input[type="range"].slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

input[type="range"].slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: #8b7b8a;
    border-radius: 3px;
    border: none;
}

input[type="range"].slider::-moz-range-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: #8b7b8a;
    border-radius: 3px;
    border: none;
}

input[type="range"].slider::-ms-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: transparent;
    border-color: transparent;
    color: transparent;
}

input[type="range"].slider::-ms-fill-lower {
    background: #8b7b8a;
    border-radius: 3px;
}

input[type="range"].slider::-ms-fill-upper {
    background: #8b7b8a;
    border-radius: 3px;
}

input[type="range"].slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8e8a9f;
    cursor: pointer;
    margin-top: -7px;
}

input[type="range"].slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8e8a9f;
    cursor: pointer;
    border: none;
}

input[type="range"].slider::-ms-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8e8a9f;
    cursor: pointer;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

.slider-value {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #8e8a9f;
    margin-top: 10px;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-nav);
    border: 1px solid var(--border-light);
    border-radius: 5px;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-item.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-nav);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.checkbox-label:hover {
    background: var(--border-light);
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.med-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.med-item {
    background: #f0eff3;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #a294a1;
    margin-bottom: 15px;
}

.med-item h4 {
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 1.1rem;
    font-weight: 600;
}

.med-item p {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 3px 0;
}

.photo-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    margin-top: 10px;
}

canvas {
    max-width: 100%;
    height: auto !important;
}

.chart-container {
    position: relative;
    width: 100%;
    margin-bottom: 30px;
}

.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    padding-right: 5px;
}

.collapsible-header:hover {
    opacity: 0.8;
}

.collapse-icon {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.collapse-icon.collapsed {
    transform: rotate(-90deg);
}

.collapsible-content {
    max-height: 5000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-content.collapsed {
    max-height: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.no-pet-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-pet-message h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
    }

    .header {
        padding: 20px 15px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .content {
        padding: 15px 8px;
    }

    .nav-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-tab {
        padding: 12px 20px;
        font-size: 14px;
    }

    .calendar {
        padding: 8px 4px;
        overflow-x: visible;
    }

    .calendar-grid {
        gap: 2px;
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .calendar-day-header {
        padding: 5px;
        font-size: 12px;
    }

    .calendar-day {
        min-height: 55px;
        max-height: 55px;
        padding: 3px;
        font-size: 12px;
        overflow: hidden;
    }

    .day-number {
        font-size: 12px;
        margin-bottom: 2px;
    }

    .day-icons {
        gap: 1px;
        overflow: hidden;
    }

    .day-icon {
        font-size: 11px;
        color: #8b7b8a;
    }

    .calendar-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .calendar-header h2 {
        font-size: 20px;
        text-align: center;
    }

    .calendar-nav {
        justify-content: center;
    }

    .btn {
        padding: 10px 18px;
        font-size: 14px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .pet-selector {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .modal-content {
        padding: 20px;
        margin: 10px;
    }

    .entry-section {
        padding: 15px;
    }

    .entry-section h3 {
        font-size: 18px;
    }

    canvas {
        max-width: 100%;
        width: 100% !important;
        height: auto !important;
    }

    .chart-container {
        width: 100%;
        overflow: hidden;
    }

    .pet-profile-photo {
        width: 150px;
        height: 150px;
    }
}

@media print {
    /* Hide navigation and UI elements */
    .header, .nav-tabs, .btn, button, .close-btn, .modal, .pet-selector {
        display: none !important;
    }
    
    /* Make content full width */
    .container {
        max-width: 100%;
        box-shadow: none;
        border-radius: 0;
    }
    
    .content {
        padding: 20px;
    }
    
    /* Ensure sections are visible */
    .entry-section {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
    
    /* Show all collapsible content */
    .collapsible-content {
        max-height: none !important;
        display: block !important;
    }
    
    /* Hide collapse icons */
    .collapse-icon {
        display: none !important;
    }
    
    /* Make text black for printing */
    body {
        color: #000;
        background: #fff;
    }
    
    /* Calendar print styles */
    .calendar-grid {
        border: 1px solid #000;
    }
    
    .calendar-day {
        border: 1px solid #ccc;
        min-height: 60px;
    }
    
    /* Chart handling for printing */
    canvas {
        max-width: 100%;
    }
    
    .chart-container {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 15px;
    }
    
    /* Print chart images - sized to fit ~2 per page */
    .print-chart-img {
        display: block !important;
        max-width: 100% !important;
        max-height: 40vh !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain;
        page-break-inside: avoid;
    }
    
    /* Statistics summary print styles */
    .observation-statistics-section {
        page-break-inside: avoid;
    }
    
    .pattern-insights-section {
        page-break-inside: avoid;
    }
    
    .stat-card {
        border: 1px solid #ccc !important;
        background: #fff !important;
    }
    
    /* Hide search bars when printing */
    #medSearchInput,
    #dietSearchInput,
    #medSearchInput[type="text"],
    #dietSearchInput[type="text"] {
        display: none !important;
    }
    
    /* Also hide the wrapper div around search inputs */
    div:has(> #medSearchInput),
    div:has(> #dietSearchInput) {
        display: none !important;
    }
    
    /* Two-column medication cards for printing */
    .print-two-col {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    
    .print-two-col h3 {
        grid-column: 1 / -1 !important;
    }
    
    .print-two-col .med-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    /* My Pets header consistent padding */
    #pets > div:first-child {
        margin-bottom: 20px;
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    flex-shrink: 0;
    margin-left: 10px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: #8b7b8a;
}

.switch input:checked + .slider:before {
    transform: translateX(26px);
}

/* ===== Content Section Standardization ===== */
/* Consistent typography across all content sections */
.view > div p,
.view > div span,
.view > div strong,
.view > div td,
.view > div li,
.entry-section p,
.entry-section span,
.entry-section li,
.med-item p,
.stat-card p {
    font-size: 16px;
    line-height: 1.6;
}

/* Consistent h2 sizes across all views */
.view h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

/* Consistent h3 sizes across all content sections */
.view h3 {
    font-size: 1.15rem;
    margin-bottom: 15px;
}

/* Consistent h4 sizes across all content sections */
.view h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 5px;
}

/* Pet profile info text */
.pet-profile-info p {
    font-size: 16px;
    line-height: 1.8;
}

/* Compact buttons on content cards (medications, diet, appointments) */
.med-item .btn,
#appointmentsContent .card .btn {
    padding: 8px 16px;
    font-size: 14px;
}

/* Appointment header-to-card spacing */
#appointmentsContent h3 + div {
    margin-top: 15px;
}

/* Dark mode note card headers */
body.dark-mode #notesContent h4 {
    color: #a89fb5;
}

/* Undo Toast */
.undo-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 10000;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    font-size: 15px;
    animation: toastSlideUp 0.3s ease;
    max-width: 90vw;
}

.undo-toast.hiding {
    animation: toastSlideDown 0.3s ease forwards;
}

.undo-toast button {
    background: none;
    border: none;
    color: #a294a1;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.undo-toast button:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

body.dark-mode .undo-toast {
    background: #4a4a4a;
    border: 1px solid #666;
}

/* Calendar Day Preview Popup */
.day-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.day-preview {
    background: var(--bg-container);
    border-radius: 12px;
    padding: 18px;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    border: 2px solid #8e8a9f;
}

.day-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.day-preview-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.day-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-primary);
    padding: 4px 0;
}

.day-preview-sublist {
    margin: 2px 0 4px 28px;
    padding: 0 0 0 14px;
    list-style: disc;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.day-preview-sublist li {
    padding: 1px 0;
}

@keyframes toastSlideUp {
    from { transform: translateX(-50%) translateY(100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes toastSlideDown {
    from { transform: translateX(-50%) translateY(0); opacity: 1; }
    to { transform: translateX(-50%) translateY(100px); opacity: 0; }
}

/* ===== Google Drive Sync Styles ===== */

.backup-reminder-card {
    margin-top: 30px;
    padding: 15px;
    background: #f0eff3;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

body.dark-mode .backup-reminder-card {
    background: rgba(255, 255, 255, 0.08);
}

.sync-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.sync-status-disconnected {
    background: var(--border-light);
    color: var(--text-secondary);
}

.sync-status-connected {
    background: #e8f5e9;
    color: #2e7d32;
}

body.dark-mode .sync-status-connected {
    background: #1b3a1e;
    color: #81c784;
}

.sync-status-syncing {
    background: #e3f2fd;
    color: #1565c0;
}

body.dark-mode .sync-status-syncing {
    background: #0d2137;
    color: #64b5f6;
}

.sync-status-error {
    background: #ffebee;
    color: #c62828;
}

body.dark-mode .sync-status-error {
    background: #3a1a1a;
    color: #ef9a9a;
}

.sync-account-info {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--border-light);
    border-radius: 8px;
}

.sync-last-time {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 10px;
    padding: 0 4px;
}

.sync-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.sync-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--border-color);
    border-top-color: #8b7b8a;
    border-radius: 50%;
    animation: syncSpin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes syncSpin {
    to { transform: rotate(360deg); }
}

.sync-conflict-info {
    margin-top: 12px;
    padding: 12px 14px;
    background: #fff8e1;
    border-radius: 8px;
    font-size: 13px;
    color: #f57f17;
    border-left: 3px solid #f57f17;
}

body.dark-mode .sync-conflict-info {
    background: #3a3020;
    color: #ffd54f;
    border-left-color: #ffd54f;
}

#syncNowBtn .material-icons {
    transition: transform 0.3s ease;
}

#syncNowBtn:active .material-icons {
    transform: rotate(180deg);
}

/* Sync toast notification */
.sync-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: toastSlideUp 0.3s ease-out;
    white-space: nowrap;
}

.sync-toast .material-icons {
    font-size: 18px;
}

.sync-toast.sync-toast-success {
    background: #2e7d32;
}

.sync-toast.sync-toast-error {
    background: #c62828;
}
