/* --- Global Styles & Variables --- */
:root {
    --red-dark: #BB010B;
    --red-light: #CD1624;
    --green-dark: #006F57;
    --green-light: #23856D;
    --off-white: #FAF8F8;
    --text-color: #333;
    --text-color-zero: #999; 

    --font-primary: 'Roboto', sans-serif; 
    --font-secondary: 'Roboto', sans-serif;
    --font-script: 'Pacifico', cursive;
    --font-headings: 'Mountains of Christmas', cursive;

    --shadow: 0 4px 15px rgba(0,0,0,0.1);
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

html, body {
    height: 100%;
    width: 100%;
    font-family: var(--font-secondary);
    background-color: var(--off-white);
    color: var(--text-color);
    overflow: hidden;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23bb010b' fill-opacity='0.1'%3E%3Cpath d='M0 38.59l2.83-2.83 1.41 1.41L1.41 40H0v-1.41zM0 1.4l2.83 2.83 1.41-1.41L1.41 0H0v1.41zM38.59 40l-2.83-2.83 1.41-1.41L40 38.59V40h-1.41zM40 1.41l-2.83 2.83-1.41-1.41L38.59 0H40v1.41zM20 18.6l2.83-2.83 1.41 1.41L21.41 20l2.83 2.83-1.41 1.41L20 21.41l-2.83 2.83-1.41-1.41L18.59 20l-2.83-2.83 1.41-1.41L20 18.59z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    
    /* Disable text selection globally */
    -webkit-user-select: none; /* Safari/Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE/Edge */
    user-select: none;
}

/* Allow text selection in inputs/textareas so user can still type/edit */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* --- Transitions --- */
.fade-out { opacity: 0; }
#login-page.fade-in { opacity: 1; }

/* --- Splash Screen --- */
#splash-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--off-white);
    background-image: inherit;
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
    transition: opacity 0.8s ease-out;
}
#splash-screen img { width: 80%; max-width: 300px; animation: pulse 2s infinite ease-in-out; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* --- Login Page --- */
#login-page {
    display: none; justify-content: center; align-items: center;
    height: 100%; padding: 20px; opacity: 0; transition: opacity 0.8s ease-in;
}
.login-container {
    width: 100%; max-width: 400px; border-radius: 15px; box-shadow: var(--shadow);
    background-image: linear-gradient(to bottom, 
        rgba(250, 248, 248, 0.85) 0%, rgba(250, 248, 248, 0.6) 25%,
        rgba(250, 248, 248, 0.6) 75%, rgba(250, 248, 248, 0.85) 100%
    );
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.login-content { background: transparent; padding: 30px 25px; text-align: center; }
.login-logo { width: 180px; margin-bottom: 5px; }
.login-content h1 {
    font-family: var(--font-script); color: var(--red-dark); font-size: 2.2rem;
    line-height: 1; margin-bottom: 15px; font-weight: 400;
}
.login-content p { margin-bottom: 20px; color: #555; }
.input-group { text-align: left; margin-bottom: 15px; }
.input-group-inline { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 20px; }
.input-group-inline label { font-weight: 500; font-size: 0.9rem; }
.input-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 0.9rem; }
.input-group input, .input-group select, .input-group textarea { 
    width: 100%; padding: 6px 10px; border: 1px solid #ccc; border-radius: 6px;
    font-size: 1rem; background: rgba(255,255,255,0.7); height: 36px; text-align: left;
    font-family: var(--font-primary);
}
.input-group textarea { height: auto; resize: vertical; }

.input-group input[type="date"] {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    position: relative; text-align: left; display: -webkit-inline-flex; 
    justify-content: flex-start; color: var(--text-color);
}
.input-group input[type="date"]::-webkit-date-and-time-value { text-align: left; color: var(--text-color); }

/* --- Standardized Buttons --- */
.btn {
    display: inline-flex; justify-content: center; align-items: center;
    height: 40px; padding: 0 15px; border-radius: 6px; font-size: 1rem;
    font-weight: 700; cursor: pointer; text-decoration: none; border: 1px solid transparent;
    transition: background-color 0.3s, border-color 0.3s, opacity 0.3s;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background-color: var(--red-dark); color: white; border: none; }
.btn-primary:hover:not(:disabled) { background-color: var(--red-light); }
.btn-secondary { background-color: #eee; color: #555; border-color: #ccc; }
.btn-secondary:hover:not(:disabled) { background-color: #ddd; }
.btn-danger { background-color: #e74c3c; color: white; border: none; }
.btn-danger:hover:not(:disabled) { background-color: #c0392b; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 0.8rem; font-weight: 600; border-radius: 5px; }
.error-message { background: #ffdddd; color: #d8000c; padding: 10px; border-radius: 5px; margin-bottom: 15px; font-size: 0.9rem; }

/* --- Main App Wrapper & Scrolling --- */
/* --- Main App Wrapper & Scrolling --- */
.app-loading { visibility: hidden; }
#app-wrapper { 
    height: 100vh; 
    background-color: var(--off-white); 
    overflow-y: auto; 
    overflow-x: hidden; /* Added to freeze horizontal movement */
    -webkit-overflow-scrolling: touch; 
}
main { padding: 15px; padding-bottom: 130px; }
#settings-content { display: none; padding: 15px; padding-bottom: 110px; }
#settings-page { display: flex; flex-direction: column; gap: 20px; }
.settings-section { margin-bottom: 0; }

#top-bars-container {
    position: -webkit-sticky; position: sticky; top: 0; z-index: 10;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}




header {
    background: transparent; padding: 10px 15px; padding-top: calc(10px + var(--safe-area-top)); 
    display: flex; 
    justify-content: space-between; /* Changed from flex-start to push items apart */
    align-items: center; 
    /* gap: 15px; Removed gap on parent, handled by children */
    flex-shrink: 0;
    padding: 0px 10px 0px;
}

/* New wrapper for Logo + Title */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo { height: 50px; }
header h1 { font-family: var(--font-script); color: var(--red-dark); font-size: 1.8rem; font-weight: 400; line-height: 1; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 2px; /* Small gap between buttons */
}

.header-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 1.2rem; /* Reduced from 1.3rem to match others better */
    color: var(--green-dark);
    transition: transform 0.2s ease, color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.header-btn:hover {
    background-color: transparent; 
    transform: scale(1.1);
    color: var(--red-dark); 
}

#progress-container { padding: 5px 15px; background: transparent; flex-shrink: 0; }
#progress-bar-background { width: 100%; height: 10px; background-color: rgba(221, 221, 221, 0.7); border-radius: 5px; position: relative; box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); }
#progress-bar { position: absolute; top: 0; left: 0; height: 100%; width: 0%; border-radius: 5px; z-index: 1; transition: width 0.5s ease-in-out; }
#sleigh-icon { position: absolute; top: 50%; left: 0%; transform: translateY(-50%); color: var(--red-dark); transition: left 0.5s ease-in-out; z-index: 2; filter: drop-shadow(0 0 4px rgba(255, 100, 100, 0.7)); }
.sleigh-svg { height: 50px; width: auto; display: block; transform: translateY(-5px) translateX(10px); }

#totals-bar, #stats-bar { 
    background: transparent; padding: 8px 15px; border-bottom: 1px solid rgba(0,0,0,0.05); 
    display: flex; justify-content: space-around; align-items: center; text-align: center;
}
#stats-bar.clickable { cursor: pointer; }

.total-box, .stat-box { flex: 1; }
.total-box h4, .stat-box h4 { font-size: 0.7rem; color: #666; text-transform: uppercase; margin-bottom: 3px; }
.total-box p, .stat-box p { 
    font-size: 1.2rem; font-weight: 700;
    background: linear-gradient(135deg, var(--green-dark) 40%, var(--green-light) 60%);
    color: #fff; background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    transition: all 0.3s ease;
}
.stat-box p.is-zero { color: var(--text-color-zero); -webkit-text-fill-color: var(--text-color-zero); background: none; font-weight: 500; }
.total-box-action { flex: 0 0 40px; text-align: center; }

/* --- Kid Section --- */
.kid-section { background: white; border-radius: 12px; margin-bottom: 20px; box-shadow: var(--shadow); overflow: hidden; }
.kid-header { 
  /* UPDATED: Only the background property is changed */
background: repeating-linear-gradient(
  -45deg,
  transparent,
  transparent 12px,
  rgba(0,0,0,0.05) 12px,
  rgba(0,0,0,0.05) 24px
),

    linear-gradient(135deg, var(--red-dark), var(--red-light));
  
  /* --- All other properties below are identical to your original code --- */
  color: var(--off-white); 
  padding: 4px 15px; /* Reverted to original padding */
  font-family: var(--font-script); 
  font-size: 1.2rem;
  font-weight: 400; 
  text-align: left; 
  letter-spacing: 1px;
  position: relative; 
  overflow: hidden; 
  text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  cursor: pointer; 
  user-select: none;
}

.kid-header > .kid-header-left { display: flex; align-items: center; gap: 10px; flex-grow: 1; }
.kid-header span.name-text {
  background: linear-gradient(to right, #FAF8F8 40%, #ffffff 50%, #FAF8F8 60%);
  background-size: 200% auto; color: #000;
  background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: shine 5s linear infinite;
}
.kid-header-stats { text-align: right; font-family: var(--font-primary); font-size: 0.8rem; font-weight: 500; text-shadow: none; display: flex; align-items: center; gap: 10px; }
.kid-gift-count { background: rgba(0,0,0,0.1); padding: 2px 8px; border-radius: 10px; }
.kid-gift-count .fa-solid { font-size: 0.7rem; margin-right: 4px; }
.kid-gift-cost { font-weight: 700; letter-spacing: 0.5px; }

/* Collapsible Header Icon */
.header-toggle-icon { transition: transform 0.3s ease; font-size: 0.9rem; opacity: 0.8; }
.kid-header.collapsed .header-toggle-icon { transform: rotate(-90deg); }
.kid-header:not(.collapsed) .header-toggle-icon { transform: rotate(0deg); } /* Points down */

/* List visibility */
.gift-list { transition: max-height 0.3s ease-in-out; }
.gift-list.hidden { display: none; }

/* --- Gift Item --- */
.gift-item { display: flex; align-items: center; padding: 8px 15px; border-bottom: 1px solid #f0f0f0; gap: 12px; transition: background-color 0.3s, opacity 0.3s; }
.gift-item:last-child { border-bottom: none; }
.gift-info { flex-grow: 1; cursor: pointer; }
.gift-name { font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.group-badge { background: var(--red-light); color: white; font-size: 0.7rem; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; justify-content: center; align-items: center; font-weight: 700; flex-shrink: 0; }
.gift-details { font-size: 0.8rem; color: #555; margin-top: 4px; }
.gift-details .price { font-weight: 500; color: var(--green-dark); }
.gift-details .source { font-style: italic; }
.gift-status { display: flex; gap: 8px; align-items: center; }

/* --- UNIFIED SNOWFLAKE STYLES (Main List & Stats Modal) --- */
.status-icon {
    font-size: 1.4rem;
    color: #e0e0e0; /* Lighter, frosty grey for unselected */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy transition */
    opacity: 1; /* Remove old opacity */
}
.status-icon:hover {
    transform: scale(1.2); /* Slightly bigger hover effect */
}
.status-icon.active {
    color: #C80000; 
    transform: scale(1.1);
    text-shadow: 0 0 10px rgba(200, 0, 0, 0.8);
}




.status-icon.disabled {
    color: #f0f0f0 !important; /* Even lighter for disabled */
    cursor: not-allowed;
    pointer-events: none;
    transform: scale(1);
    opacity: 0.7;
}

.gift-link { font-size: 0.8rem; margin-top: 6px; }
.gift-link a { color: var(--green-dark); text-decoration: none; font-weight: 500; }
.gift-link a:hover { text-decoration: underline; }
.gift-link i { font-size: 0.7rem; margin-left: 3px; position: relative; top: -1px; }
.gift-item.completed { background-color: #f2f2f2; opacity: 0.8; }
.gift-item.completed .gift-info {color: #999; }
.order-reminder { font-size: 0.7rem; color: var(--red-dark); font-weight: 700; white-space: nowrap; border: 1px solid var(--red-dark); padding: 1px 4px; border-radius: 4px; margin-left: 4px; }





/* --- Bottom Toolbar (Footer) --- */
#bottom-toolbar {
    position: fixed; bottom: 0; left: 0; right: 0; box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex; justify-content: space-around; padding-bottom: 10px; 
    z-index: 100; flex-shrink: 0; background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0,0,0,0.05);
}
.nav-btn { flex: 1; padding: 10px 5px; text-align: center; color: #888; text-decoration: none; border: none; background: none; cursor: pointer; }
.nav-btn.active { color: var(--red-dark); }
.nav-btn i { font-size: 1.3rem; display: block; margin-bottom: 4px; }
.nav-btn span { font-size: 0.7rem; font-weight: 500; }
#add-item-btn { 
    transform: translateY(-15px); background: var(--red-dark); color: white; 
    border-radius: 50%; width: 40px; height: 40px;
    display: flex; justify-content: center; align-items: center; 
    border: 3px solid white; box-shadow: var(--shadow); 
}
#add-item-btn i { font-size: 1.8rem; margin: 0; }

/* --- Modals --- */
/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* FROSTY GRADIENT BACKGROUND */
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), rgba(240, 240, 240, 0.7));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: var(--off-white);
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 450px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    /* ENHANCED SHADOW FOR POP */
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border: 1px solid rgba(0, 0, 0, 0.05); /* Subtle outline */
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.modal-content.non-admin .admin-only { display: none; }
.modal-overlay.visible .modal-content { transform: scale(1); }
.modal-header { padding: 20px 20px 0 20px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-shrink: 0; }
.modal-header h2 { font-family: var(--font-script); color: var(--red-dark); font-size: 1.4rem; font-weight: 700; }
.modal-close { border: none; background: none; font-size: 1.3rem; color: #888; cursor: pointer; }
.modal-body { padding: 0 20px 20px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#confirm-body { padding: 0 20px; }
#confirm-body p { margin-bottom: 15px; text-align: center; font-size: 1rem; color: #555; line-height: 1.5; }
#prompt-input-group, #prompt-select-group { display: none; text-align: left; margin-top: 10px; }
.modal-content > .form-actions { padding: 0 20px 20px; }
.form-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 20px; flex-shrink: 0; }
.form-actions .btn, .form-actions .btn-group { width: 100%; max-width: 320px; }
.btn-group { display: flex; gap: 10px; }
.btn-group .btn { flex: 1; }

/* --- Settings Page --- */
.settings-section { background: white; padding: 15px; border-radius: 12px; box-shadow: var(--shadow); }
.settings-section hr { margin: 20px 0; border: none; border-top: 1px solid #f0f0f0; }
.settings-section h3 { font-family: var(--font-script); color: var(--green-dark); font-size: 1.4rem; font-weight: 400; margin-bottom: 15px; }
#settings-page .input-group { max-width: 320px; margin-left: auto; margin-right: auto; }
.management-list { list-style: none; padding: 0; }
.management-list li { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; gap: 8px; }
.management-list li:last-child { border-bottom: none; }
.management-list .item-name { flex-grow: 1; }
.management-list .item-actions { display: flex; gap: 8px; align-items: center; }
.management-list .item-actions select { height: 32px; font-size: 0.9rem; padding: 0 5px; border-radius: 5px; }
.drag-handle { cursor: grab; padding: 0 8px; color: #aaa; font-size: 1.2rem; }
.sortable-ghost { background-color: #f0f8ff; opacity: 0.7; }

/* --- Utility Classes --- */
.empty-state-message { text-align: center; padding: 40px; color: #888; }
.permission-denied { padding: 20px; text-align: center; color: var(--red-dark); font-weight: 500; }
.fa-spin-santa { animation: spin 1.5s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.btn .fa-spin-santa { margin-right: 8px; }
.btn .fa-spin-santa:only-child { margin-right: 0; }

/* --- Gift Item Camera Icon & Image Preview/Viewer --- */
.view-image-btn { font-size: 1.2rem; color: #c7c7c7; cursor: pointer; transition: transform 0.2s; padding-right: 8px; }
.view-image-btn:hover { transform: scale(1.1); }
#image-preview-container { position: relative; width: 120px; height: 120px; border: 2px dashed #ccc; border-radius: 8px; overflow: hidden; margin: 0 auto 10px auto; }
#image-preview { width: 100%; height: 100%; object-fit: cover; }
.remove-image-btn { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(0,0,0,0.6); color: white; font-size: 1.2rem; line-height: 1; cursor: pointer; display: flex; justify-content: center; align-items: center; padding-bottom: 2px; }
.file-input-wrapper { width: 100%; display: flex; justify-content: center; }
.file-input-label { gap: 8px; padding-block: 10px; width: 100%; }
#image-viewer-modal .modal-content { background: transparent; box-shadow: none; width: 100%; height: 100%; max-width: none; max-height: none; border-radius: 0; align-items: center; justify-content: center; padding: 20px; }
#image-viewer-modal .modal-close { position: fixed; top: calc(15px + var(--safe-area-top)); right: 15px; color: white; background: rgba(0,0,0,0.5); width: 36px; height: 36px; border-radius: 50%; font-size: 1.2rem; z-index: 10; }
#image-viewer-loader { display: none; color: white; font-size: 4rem; }
#image-viewer-modal #viewer-image { max-width: 100%; max-height: 80vh; border-radius: 8px; box-shadow: 0 5px 20px rgba(0,0,0,0.5); display: none; }
#image-viewer-modal #viewer-comment { color: white; text-align: center; margin-top: 15px; font-size: 1rem; background: rgba(0,0,0,0.5); padding: 8px 12px; border-radius: 6px; max-width: 90%; }

/* --- Progress Bar --- */
@keyframes candy-cane-scroll { to { background-position: 28px 0; } }
#progress-bar, #upload-progress-bar {
    background: repeating-linear-gradient(135deg, var(--red-dark), var(--red-dark) 10px, var(--off-white) 10px, var(--off-white) 20px);
    background-size: 28px 28px;
}
#upload-progress-bar { animation: candy-cane-scroll 0.5s linear infinite; }
#upload-progress-container { width: 100%; height: 12px; background-color: #f0f0f0; border-radius: 6px; overflow: hidden; border: 1px solid #ccc; padding: 2px; }
#upload-progress-bar { width: 0%; height: 100%; border-radius: 4px; transition: width 0.2s ease-out; }

/* --- MODIFIED: Modal View/Edit/Footer Styles --- */
.modal-footer { display: flex; justify-content: space-between; align-items: center; padding: 0 20px 20px 20px; margin-top: 15px; flex-shrink: 0; gap: 10px; }
.modal-footer .btn { flex: 1 1 0px; }

/* View Mode Button States */
.modal-content.view-mode #delete-gift-btn,
.modal-content.view-mode #cancel-edit-btn,
.modal-content.view-mode #save-gift-btn { display: none; }
/* Edit Mode Button States */
.modal-content.edit-mode #edit-gift-btn,
.modal-content.edit-mode #copy-gift-btn,
.modal-content.edit-mode #ok-gift-btn { display: none; }

.modal-content.edit-mode .btn-group-left { order: 1; }
.modal-content.edit-mode .btn-group-right { order: 2; }

/* General View/Edit Content Hiding */
.modal-content.view-mode .edit-field { display: none !important; }
.modal-content.edit-mode .view-field,
.modal-content.edit-mode .item-view-display { display: none !important; }
.modal-content.view-mode #image-preview-container { display: none !important; }

.view-field { font-size: 1rem; padding: 7px 0; min-height: 36px; display: block; word-wrap: break-word; white-space: pre-wrap; color: #333; }
.view-field[data-field="purchase_link"]:not(:empty) { text-decoration: underline; color: var(--green-dark); cursor: pointer; }
.view-field-hr { border: none; border-top: 1px solid #e0e0e0; margin: 10px 0; display: none; }
.modal-content.view-mode .view-field-hr { display: block; }

#modal-audit-info { padding: 15px 20px 0 20px; border-top: 1px solid #e0e0e0; min-height: 20px; display: flex; flex-direction: column; justify-content: center; }
#audit-text-container p { margin: 0 0 8px 0; display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: #666; }
#audit-text-container p:last-child { margin-bottom: 0; }
#audit-text-container .fa-snowflake { color: var(--red-dark); }
.item-view-display { position: relative; text-align: center; padding-bottom: 15px; border-bottom: 1px solid #e0e0e0; margin-bottom: 15px; min-height: 100px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.item-view-image { display: block; max-width: 100%; height: auto; max-height: 250px; border-radius: 8px; margin: 0 auto 15px auto; opacity: 1; transition: opacity 0.3s ease-in-out; }
.item-view-image.loading { opacity: 0; }
.item-view-image-loader { font-size: 2rem; color: var(--red-dark); position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: none; }
.item-view-name { font-size: 1.5rem; font-weight: 700; color: var(--text-color); }

/* --- Stats Breakdown Modal --- */
/* --- Stats Breakdown Modal --- */
#stats-modal .modal-content { max-width: 500px; }
#stats-modal .modal-footer { justify-content: center; }

.stats-breakdown-group { margin-bottom: 15px; }

/* Header Layout: Supplier Left, Info Stacked Right */
.stats-breakdown-group h4 { 
    font-family: var(--font-script); 
    color: var(--green-dark); 
    font-size: 1.2rem; 
    margin-bottom: 8px; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 5px; 
    
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; /* Aligns to top so text wraps nicely */
}

.stats-supplier-name {
    flex: 1;
    padding-right: 10px;
    word-break: break-word;
    text-align: left;
}

.stats-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    flex-shrink: 0;
}

.stats-count { 
    font-family: var(--font-primary); 
    font-size: 0.8rem; 
    color: #888; 
    font-weight: 500; 
    line-height: 1.2;
}

.stats-cost {
    font-family: var(--font-primary);
    font-size: 0.85rem;
    color: var(--text-color);
    font-weight: 700;
    line-height: 1.2;
    margin-top: 2px;
}

.stats-sub-info { font-size: 0.7rem; color: #999; }
.stats-sub-price { font-size: 0.75rem; color: var(--red-light); font-weight: 500; }

.stats-breakdown-list { list-style: none; padding-left: 5px; margin-bottom: 15px; }

/* List Item Layout */
.stats-breakdown-item { 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 8px 0; 
    gap: 8px; 
    font-size: 0.95rem; 
    border-bottom: 1px dashed #f5f5f5;
}
.stats-breakdown-item:last-child { border-bottom: none; }

.gift-name-container { 
    flex-grow: 1; 
    display: flex;
    flex-wrap: wrap; /* Allows name/price/badge to wrap on mobile */
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}

.gift-name-link {
    color: var(--green-dark);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted var(--green-dark);
}
.gift-name-text { font-weight: 500; }

/* Price Styling inside list */
.stats-item-price {
    font-size: 0.85rem;
    color: #333;
    font-weight: 700;
    background-color: rgba(0,0,0,0.05);
    padding: 1px 5px;
    border-radius: 4px;
}

.kid-name-badge { 
    font-size: 0.7rem; 
    background: #eee; 
    padding: 2px 6px; 
    border-radius: 4px; 
    color: #555; 
    white-space: nowrap;
}

.stats-icons {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.stats-breakdown-item .status-icon { font-size: 1rem; }

.stats-breakdown-item a { color: var(--green-dark); text-decoration: none; margin-left: 4px; }

/* --- Sexy Custom Select Dropdown --- */
#prompt-select-group { padding: 10px 0; }
#prompt-select-group label { margin-bottom: 12px; font-weight: 500; font-size: 1.1rem; display: block; text-align: center; color: #555; }
#prompt-select-group .custom-select-wrapper { position: relative; }
#prompt-select-group .custom-select-trigger {
    background: #fff; border: 1px solid #ccc; border-radius: 8px; padding: 0 15px;
    height: 48px; display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; user-select: none; font-size: 1.2rem; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
#prompt-select-group .custom-select-trigger::after {
    content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    transition: transform 0.2s; color: #888;
}
#prompt-select-group .custom-select-wrapper.open .custom-select-trigger::after { transform: rotate(180deg); }
#prompt-select-group .custom-select-options {
    position: absolute; bottom: 100%; /* Position above the trigger */
    left: 0; right: 0; background: #fff;
    border: 1px solid #ccc; border-radius: 8px; margin-bottom: 5px;
    max-height: 160px; overflow-y: auto; z-index: 1001;
    opacity: 0; visibility: hidden; transform: translateY(10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s; box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
}
#prompt-select-group .custom-select-wrapper.open .custom-select-options { opacity: 1; visibility: visible; transform: translateY(0); }
#prompt-select-group .custom-select-option { padding: 15px; cursor: pointer; font-size: 1.1rem; border-bottom: 1px solid #f0f0f0; }
#prompt-select-group .custom-select-option:last-child { border-bottom: none; }
#prompt-select-group .custom-select-option:hover { background-color: #f7f7f7; }
#prompt-select-group .custom-select-option.selected { background-color: var(--green-light); color: white; font-weight: 500; }

/* --- Connection Toast --- */
#connection-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 12px 20px;
    border-radius: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}
#connection-toast.show {
    transform: translateY(0);
    opacity: 1;
}
#connection-toast i {
    font-size: 1.1rem;
}
/* Offline State */
#connection-toast.offline {
    border-left: 4px solid var(--red-dark);
}
#connection-toast.offline i {
    color: var(--red-dark);
}
/* Online State */
#connection-toast.online {
    border-left: 4px solid var(--green-dark);
}
#connection-toast.online i {
    color: var(--green-dark);
}

/* --- Mobile & Desktop Specifics --- */
@media (max-width: 767px) {
    .modal-footer { flex-wrap: wrap; justify-content: center; gap: 10px; }
    .modal-footer .btn { min-width: 95px; }
    #connection-toast {
        left: 20px; /* Centered or full width on mobile? */
        right: 20px;
        justify-content: center;
        bottom: 80px; /* Above navbar */
    }
}
@media (min-width: 768px) {
    body { overflow: auto; }
    #login-page .login-container { max-width: 400px; }
    #app-wrapper { max-width: 800px; margin: 2rem auto; height: auto; min-height: calc(100vh - 4rem); border-radius: 20px; overflow: hidden; box-shadow: 0 0 30px rgba(0,0,0,0.1); }
    #bottom-toolbar { position: relative; bottom: auto; left: auto; right: auto; box-shadow: none; border-top: 1px solid #eee; }
    #add-item-btn { transform: translateY(0); }
    main, #settings-content { padding-bottom: 60px; }
    header h1 { font-size: 2.2rem; }
    .kid-header, .settings-section h3 { font-size: 1.4rem; }
    .modal-footer .btn { flex-basis: 0; }
}



/* Floating Calculator Bar */
#calculator-bar {
    position: fixed;
    bottom: 80px; /* Above nav bar */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: rgba(33, 33, 33, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#calculator-bar.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

.calc-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calc-label {
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 500;
}

#calc-total {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

#calc-count {
    font-size: 0.9rem;
    color: #aaa;
}

#calc-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
}

#calc-close:hover {
    color: white;
}

/* Calculator Selected State */
.gift-item.calc-selected {
    background-color: rgba(35, 133, 109, 0.1); /* Green Light tint */
    border-left: 4px solid var(--green-dark);
}

.gift-item.calc-selected .price {
    font-weight: 700;
    text-decoration: underline;
}

/* --- Flagging Feature --- */
.gift-flag {
    margin-right: 8px;
    font-size: 0.9rem;
    cursor: help;
}

.flag-red { color: var(--red-dark); }
.flag-orange { color: orange; }

/* Flag Modal Styles */
.flag-options {
    display: flex;
    gap: 10px;
    justify-content: space-around;
    margin-bottom: 15px;
}

.flag-option {
    cursor: pointer;
    text-align: center;
}

.flag-option input {
    display: none;
}

.flag-preview {
    display: block;
    padding: 10px 15px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
}

.flag-preview i {
    margin-right: 5px;
}

.flag-option input:checked + .flag-preview {
    border-color: var(--green-dark);
    background-color: rgba(35, 133, 109, 0.1);
    color: var(--green-dark);
    transform: scale(1.05);
}

/* Breakdown Stats enhancement */
.stats-sub-info {
    font-size: 0.75rem;
    color: #888;
    font-weight: 400;
    margin-left: 5px;
}
.stats-sub-price {
    font-size: 0.75rem;
    color: var(--red-light);
    font-weight: 500;
    font-family: var(--font-primary); /* Force plain font */
}

/* --- Flag Alert in Modal --- */
.flag-alert {
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    color: white;
    font-size: 0.95rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.flag-bg-red {
    background-color: var(--red-dark);
}

.flag-bg-orange {
    background-color: #ff9800;
}



/* ... Existing CSS ... */

/* --- Calendar Feature --- */


#calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#calendar-controls button {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--red-dark);
    padding: 10px;
    cursor: pointer;
}

#calendar-month-year {
    font-family: var(--font-script);
    color: var(--green-dark);
    font-size: 1.5rem;
}

#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-header-cell {
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #888;
    padding-bottom: 5px;
}

.calendar-day {
    aspect-ratio: 1 / 1;
    border: 1px solid #eee;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 5px;
    cursor: pointer;
    position: relative;
    background: white;
}

.calendar-day:hover {
    background-color: #fafafa;
    border-color: #ddd;
}

.calendar-day.empty {
    background: transparent;
    border: none;
    cursor: default;
}

.calendar-day-number {
    font-size: 0.9rem;
    font-weight: 500;
}

.calendar-day.today {
    border-color: var(--red-light);
    background-color: rgba(205, 22, 36, 0.05);
}

.calendar-day.today .calendar-day-number {
    color: var(--red-dark);
    font-weight: 700;
}

.calendar-dots {
    display: flex;
    gap: 2px;
    margin-top: 4px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 80%;
}

.calendar-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--green-dark);
}

/* Day Edit Modal */
#day-checklist-container {
    max-height: 60vh;
    overflow-y: auto;
}

.day-checklist-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.day-checklist-item:last-child {
    border-bottom: none;
}

.day-checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--green-dark);
}

.day-checklist-label {
    flex-grow: 1;
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
}

.day-checklist-sub {
    font-size: 0.75rem;
    color: #888;
}

.day-checklist-badge {
    font-size: 0.7rem;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    color: #555;
    margin-right: auto;
    margin-top: 2px;
}



/* --- Fix: Remove Black Outline on Focus --- */
button, input, select, textarea {
    outline: none;
}

button:focus, button:active {
    outline: none;
    box-shadow: none; /* or use a custom focus ring if preferred */
}

/* Specific fix for toolbar icon buttons */
.total-box-action button,
#calculator-bar button,
#calendar-controls button {
    border: none;
    background: transparent;
    box-shadow: none;
}

/* --- Calendar Feature Styles --- */


#calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#calendar-month-year {
    font-family: var(--font-script);
    color: var(--green-dark);
    font-size: 1.5rem;
}

#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-header-cell {
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #888;
    padding-bottom: 5px;
}

.calendar-day {
    aspect-ratio: 1 / 1;
    border: 1px solid #eee;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 5px;
    cursor: pointer;
    position: relative;
    background: white;
}

.calendar-day:hover {
    background-color: #fafafa;
    border-color: #ddd;
}

.calendar-day.empty {
    background: transparent;
    border: none;
    cursor: default;
}

.calendar-day-number {
    font-size: 0.9rem;
    font-weight: 500;
}

.calendar-day.today {
    border-color: var(--red-light);
    background-color: rgba(205, 22, 36, 0.05);
}

.calendar-day.today .calendar-day-number {
    color: var(--red-dark);
    font-weight: 700;
}

.calendar-dots {
    display: flex;
    gap: 2px;
    margin-top: 4px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 80%;
}

.calendar-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--green-dark);
}

/* --- Day View (Quick List) --- */
.day-view-list {
    max-height: 60vh;
    overflow-y: auto;
}

.day-view-item {
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.day-view-item:last-child {
    border-bottom: none;
}

.day-view-item-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
}

.day-view-item-kid {
    font-size: 0.75rem;
    color: #888;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    display: inline-block;
}

.day-view-check {
    color: var(--green-dark);
    font-size: 1.1rem;
}

/* --- Day Edit (Checklist) --- */
#day-checklist-container {
    max-height: 60vh;
    overflow-y: auto;
}

.day-checklist-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.day-checklist-item:last-child {
    border-bottom: none;
}

.day-checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--green-dark);
}

.day-checklist-label {
    flex-grow: 1;
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
}

.day-checklist-sub {
    font-size: 0.75rem;
    color: #888;
}

.day-checklist-badge {
    font-size: 0.7rem;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    color: #555;
    margin-right: auto;
    margin-top: 2px;
}























/* --- Add these to your existing style.css --- */

/* Radio Group for Modal */
.radio-group {
    display: flex;
    gap: 15px;
    margin-top: 5px;
}
.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1rem;
    cursor: pointer;
}
.radio-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--green-dark);
}

/* Info Badges (Date/Location) in Main List */
.gift-extra-info {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-left: 8px;
}

.info-badge {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    color: white;
}

.info-badge.loc {
    background-color: #6c757d; /* Grey */
}

.info-badge.date {
    background-color: #17a2b8; /* Teal */
}

/* Audit Info in Modal */
#audit-text-container {
    padding: 10px 15px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
    border-radius: 8px;
}
#audit-text-container p {
    font-size: 0.8rem;
    margin-bottom: 4px;
    color: #666;
}
#audit-text-container .fa-snowflake {
    color: var(--green-dark);
    margin-right: 5px;
}

/* View Extra Details inside modal link wrapper */
#view-extra-details {
    margin-top: 5px;
    display: flex;
    gap: 5px;
}



/* Add/Update these in your style.css */

/* --- Info Badges --- */
.gift-extra-info {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    vertical-align: middle;
}

.gift-link-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
    font-size: 0.8rem;
}

/* Ensure no weird indentation gap if link is missing */
.gift-link-container:empty {
    display: none;
}

/* Badges styling */
.info-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    line-height: 1;
    display: inline-block;
}

.info-badge.loc {
    background-color: #6c757d; /* Grey */
}

.info-badge.date {
    background-color: #17a2b8; /* Teal */
}

.info-badge.courier {
    background-color: #28a745; /* Green */
}

/* Modal Radio Method Toggle */
.method-toggle {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}




/* Add these styles for the modal categories */
.form-section {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #e0e0e0;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section-heading {
    font-size: 0.9rem;
    color: var(--green-dark); /* Using your existing green var */
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    border-left: 3px solid var(--red-light); /* Little accent */
    padding-left: 8px;
}

/* Fix for Left Gap in Gift Link Container */
.gift-link-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
    font-size: 0.8rem;
    padding-left: 0; /* Ensure no padding */
}

/* If badges are the first item (because link is hidden), they should sit flush */
.gift-link-container .gift-extra-info {
    margin-left: 0; 
}

/* Badges */
.info-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    line-height: 1.2;
    display: inline-block;
}

.info-badge.loc { background-color: #6c757d; }
.info-badge.date { background-color: #17a2b8; }
.info-badge.courier { background-color: #28a745; }

/* View Field Wrapper for Link + Details in View Mode */
.view-field[data-field="purchase_link_wrapper"] {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
}



/* --- Add/Replace these in your existing CSS --- */

/* Modal Section Categories */
.form-section {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #e0e0e0;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section-heading {
    font-size: 0.9rem;
    color: var(--green-dark); 
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    border-left: 3px solid var(--red-light);
    padding-left: 8px;
}

/* Fix for Left Gap in Gift Link Container */
.gift-link-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
    font-size: 0.8rem;
    padding-left: 0; 
}

/* Ensure flush left alignment */
.gift-link-container .gift-extra-info {
    margin-left: 0; 
}

.gift-extra-info {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    vertical-align: middle;
}

/* Badges styling */
.info-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    line-height: 1.2;
    display: inline-block;
}

.info-badge.loc { background-color: #6c757d; }
.info-badge.date { background-color: #17a2b8; }
.info-badge.courier { background-color: #28a745; }

/* View Field Wrapper for Link + Details in View Mode */
.view-field[data-field="purchase_link_wrapper"] {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
}



/* --- Add/Replace these in your existing CSS --- */

.gift-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.gift-name-line {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
}

.gift-details-line {
    font-size: 0.85rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 5px;
    height: 20px; /* Consistent height for Line 2 */
}

/* Line 3: Badges - Reserved space to prevent jump */
.gift-badges-line {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 24px; /* Reserves space so layout doesn't jump */
    margin-top: 2px;
    align-items: center;
}

/* Link Icon Button */
.link-icon-btn {
    color: var(--green-dark);
    font-size: 0.8rem;
    text-decoration: none;
    margin-left: 5px;
    transition: transform 0.2s;
}
.link-icon-btn:hover {
    transform: scale(1.2);
    color: var(--red-dark);
}

/* Badges styling */
.info-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    line-height: 1.2;
    display: inline-block;
}

.info-badge.loc { background-color: #6c757d; }
.info-badge.date { background-color: #17a2b8; }
.info-badge.courier { background-color: #28a745; }
.info-badge.group { background-color: #ffc107; color: #333; } /* Yellow/Black for Group */
.info-badge.reminder { background-color: transparent; color: var(--red-dark); border: 1px solid var(--red-dark); padding: 1px 4px; }
.info-badge.overdue { background-color: var(--red-dark); color: white; }

/* Status Icons spacing fix */
.gift-status {
    display: flex;
    gap: 12px; /* Increased gap for better touch targets */
    align-items: center;
}














/* --- UPDATED GIFT ITEM LAYOUT --- */

/* Main Container for Text Info */
.gift-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0px; /* Tight spacing between lines */
    min-width: 0; /* Prevents flex items from overflowing */
}

/* Line 1: Name */
.gift-name-line {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    line-height: 1.5;
}

/* Line 2: Details (Price - Source - Link) */
.gift-details-line {
    font-size: 0.85rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 5px;
    height: 22px; /* Fixed height for consistency */
}

/* Link Icon Styling (Green, not Blue) */
.link-icon-btn {
    color: var(--green-dark); 
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s, color 0.2s;
}
.link-icon-btn:hover {
    color: var(--red-dark);
    transform: scale(1.2);
}

/* Line 3: Badges - Reserved Space to prevent jumping */
.gift-badges-line {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 24px; /* RESERVES SPACE for 3rd line always */
    align-items: center;
    margin-top: 2px;
}

/* --- BADGE STYLING (Rectangular) --- */
.info-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px; /* Rectangle with slight curve */
    font-weight: 700;
    color: white;
    white-space: nowrap;
    line-height: 1.5;
    display: inline-block;
    text-transform: capitalize;
}

/* Badge Colors */
.info-badge.group { background-color: #f0ad4e; color: white; } /* Orange-ish for Group */
.info-badge.loc { background-color: #6c757d; } /* Grey for Location */
.info-badge.date { background-color: #17a2b8; } /* Teal for Date */
.info-badge.courier { background-color: #28a745; } /* Green for Courier */

/* Reminder Badges */
.info-badge.reminder { 
    background-color: transparent; 
    color: var(--red-dark); 
    border: 1px solid var(--red-dark); 
    padding: 1px 5px; 
}
.info-badge.overdue {
    background-color: var(--red-dark);
    color: white;
    border: none;
}

/* --- STATUS ICONS (Right Side) --- */
.gift-status {
    display: flex;
    gap: 12px; /* Fixed spacing between icons */
    align-items: center;
}

/* Flag Icon in Name */
.gift-flag {
    margin-right: 6px;
    font-size: 0.9rem;
}

/* =========================================
   ADD/REPLACE AT BOTTOM OF STYLE.CSS
   ========================================= */

/* --- 1. Fix Audit Info (Clean Alignment) --- */
#audit-text-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 15px;
}

#audit-text-container p {
    margin: 0;
    font-size: 0.8rem;
    color: #555;
    display: flex;
    align-items: flex-start; /* Align icon to top, not center */
    line-height: 1.4;
}

#audit-text-container .fa-snowflake {
    margin-top: 3px; /* Push down slightly to match text height */
    margin-right: 10px;
    min-width: 16px; /* Fixed width so all icons align perfectly */
    text-align: center;
    color: var(--green-dark);
}

/* --- 2. Fix 3rd Line Layout (Prevent Jumping) --- */
.gift-badges-line {
    min-height: 26px; 
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

/* --- 3. iOS Style Group Badge (Red) --- */
.info-badge.group {
    background-color: #FF3B30 !important; /* iOS Red */
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    border-radius: 6px;
    padding: 3px 8px;
    order: -1; 
}

/* --- 4. Status Badges --- */
.info-badge.complete {
  background-color: #4E856D !important; /* Softer, darker green */
    color: white !important;
    padding: 3px 8px;
    border-radius: 6px;
}

.info-badge.not-ordered {
    background-color: #E5E5EA; /* iOS Grey */
    color: #8E8E93;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}



/* =========================================
   ADD/REPLACE AT BOTTOM OF STYLE.CSS
   ========================================= */

/* --- 1. Master Badge Style (Taller & No Strike-through) --- */
.info-badge {
    border-radius: 6px !important;
    padding: 5px 10px !important; /* Taller padding */
    font-size: 0.7rem;            /* Slightly larger text to match height */
    font-weight: 700;
    line-height: 1.1;
    display: inline-block;
    vertical-align: middle;
    text-transform: capitalize;
    box-shadow: none;
    
    /* PREVENT STRIKE-THROUGH */
    text-decoration: none !important; 
    opacity: 1 !important; /* Keep badge bright even if row is dimmed */
}

/* Ensure parent strike-through doesn't bleed into badges */
.gift-item.completed .info-badge {
    text-decoration: none !important;
    color: white; /* Ensure text stays white, not greyed out */
}

/* --- 2. Specific Colors --- */

/* Group Badge (Red) */
.info-badge.group {
    background-color: #FF3B30 !important; 
    color: white;
    order: -1; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Complete (Green) */
.info-badge.complete {
    background-color: #006F57 !important;
    color: white !important; /* Force white text */
}

/* Not Ordered (Grey) */
.info-badge.not-ordered {
    background-color: #E5E5EA !important;
    color: #8E8E93 !important; /* Exception: Grey text for grey badge */
    border: 1px solid #d1d1d6;
}

/* Location (Dark Grey) */
.info-badge.loc { 
    background-color: #8E8E93 !important; 
    color: white;
}

/* Date (Teal) */
.info-badge.date { 
    background-color: #5AC8FA !important; 
    color: white;
}

/* Courier (Green) */
.info-badge.courier { 
    background-color: #28a745 !important; 
    color: white;
}

/* Reminder (Outline) */
.info-badge.reminder { 
    background-color: transparent !important; 
    color: #FF3B30 !important; 
    border: 1px solid #FF3B30; 
}

/* Overdue (Solid Red) */
.info-badge.overdue { 
    background-color: #FF3B30 !important; 
    color: white; 
    border: none;
}

/* --- 3. Layout Fixes --- */
.gift-badges-line {
    min-height: 28px; /* Slightly taller to accommodate taller badges */
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Audit Info Alignment */
#audit-text-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 15px;
}
#audit-text-container p {
    margin: 0;
    font-size: 0.8rem;
    color: #555;
    display: flex;
    align-items: flex-start;
    line-height: 1.4;
}
#audit-text-container .fa-snowflake {
    margin-top: 3px;
    margin-right: 10px;
    min-width: 16px;
    text-align: center;
    color: var(--green-dark);
}




/* --- Add/Replace these styles at the bottom of your style.css file --- */

/* Hides form sections in view mode if ALL fields within it are empty */
.modal-content.view-mode .form-section.is-empty {
    display: none;
}

/* Hides the specific gift image input group in view mode */
.modal-content.view-mode .gift-image-group {
    display: none;
}

/* Styling for the new purchase link button */
.view-field[data-field="purchase_link_wrapper"] a.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    margin-top: -5px;
    width: auto;
    max-width: 100%;
}

.view-field[data-field="purchase_link_wrapper"] a.btn i {
    font-size: 0.9em;
}


/* --- Add this at the end of your style.css --- */

/* Hides individual form rows in view mode if their data field is empty */
.modal-content.view-mode .input-group.is-empty-field {
    display: none;
}





/* ... [Previous CSS Content remains unchanged until header section] ... */

header {
    background: transparent; 
    padding: 10px 15px; 
    padding-top: calc(10px + var(--safe-area-top)); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-shrink: 0;
    padding: 0px 10px 0px;
}

/* NEW: Allow header title to be clicked */
#header-title-container {
    cursor: pointer;
    transition: transform 0.2s;
}

#header-title-container:active {
    transform: scale(0.98);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1; 
}

/* Adjusted Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    justify-content: flex-end; 
}

/* --- NEW: Countdown Modal Styles --- */
#christmas-countdown-display {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 10px;
}

.countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.countdown-unit span[id^="countdown"] {
    font-family: var(--font-primary); /* Use regular Roboto font, not horrid cursive */
    font-size: 4rem;
    font-weight: 700;
    color: var(--red-dark);
    line-height: 1;
}

.countdown-unit .label {
    font-family: var(--font-headings);
    color: var(--green-dark);
    font-size: 1.2rem;
    margin-top: 5px;
}

/* --- NEW: Summary Modal Styles --- */
.summary-section {
    margin-bottom: 20px;
}

.summary-header {
    font-family: var(--font-script);
    color: var(--green-dark);
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 10px;
    font-size: 1.3rem;
    display: flex;
    justify-content: space-between;
}

.summary-count {
    font-family: var(--font-primary);
    font-size: 0.8rem;
    color: #888;
    font-weight: 500;
}

.summary-list {
    list-style: none;
    padding: 0;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #f0f0f0;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.summary-item:hover {
    background-color: #fafafa;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
}

.summary-name {
    font-weight: 500;
    color: #333;
}

.summary-item-details {
    font-size: 0.75rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-item-details a {
    color: var(--green-dark);
    text-decoration: none;
}

.summary-kid {
    font-size: 0.75rem;
    color: #888;
    background: #eee;
    padding: 1px 5px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.summary-date {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    white-space: nowrap;
    margin-left: 10px;
}

.summary-date.urgent { background-color: var(--red-dark); }
.summary-date.warning { background-color: #f0ad4e; }
.summary-date.good { background-color: var(--green-light); }
.summary-date.none { background-color: #ccc; color: #666; font-weight: 400; }

/* --- NEW: Search Modal Styles --- */
#search-results-list {
    margin-top: 15px;
    max-height: 60vh;
    overflow-y: auto;
}

.search-result-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background-color: #f9f9f9;
}

.search-result-name {
    font-weight: 700;
    color: var(--green-dark);
    font-size: 1rem;
}

.search-result-details {
    font-size: 0.8rem;
    color: #666;
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

/* --- ITEM FLASH HIGHLIGHT ANIMATION --- */
@keyframes flash-yellow {
    0% { background-color: #fff9c4; }
    100% { background-color: transparent; }
}

.flash-highlight {
    animation: flash-yellow 2s ease-out;
}

@media (max-width: 767px) {
    header h1 {
        font-size: 1.6rem;
    }
}

@media (max-width: 767px) {
    /* Reduce padding and size of buttons */
    .header-btn {
        padding: 4px;
        width: 30px; 
        height: 30px;
        font-size: 1.1rem;
    }

    /* Remove any gap between the buttons container */
    .header-actions {
        gap: 0px; 
    }
}


@media (max-width: 767px) {
    /* Anchors the search modal to the top instead of centering it vertically.
       This prevents it from jumping around when the keyboard opens or results load. */
    #search-modal {
        align-items: flex-start;
        padding-top: 80px; /* Leaves space for the header */
    }

    /* Adjust max-height so the bottom isn't hidden behind the keyboard */
    #search-modal .modal-content {
        max-height: 70vh; 
    }
}




/* --- Celebration Overlay --- */
#celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 20, 40, 0.8), rgba(0, 0, 0, 0.6));
    z-index: 9999;
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    pointer-events: auto;
}

#celebration-overlay.visible {
    display: flex;
    opacity: 1;
}

#celebration-message {
    text-align: center;
    color: white;
    z-index: 10001;
    animation: scaleUp 1s ease-out forwards;
}
#celebration-message h1 {
    font-family: var(--font-script); /* Changed from --font-headings */
    font-size: 4rem;
    font-weight: 400; /* Pacifico looks better with normal weight */
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.6);
    color: #fff;
    margin-bottom: 10px;
}


#celebration-message p {
    font-family: var(--font-primary);
    font-size: 1.2rem;
    opacity: 0.8;
    animation: pulse 2s infinite;
}

#confetti-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
}

#snow-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
}

.snowflake {
    position: absolute;
    top: -10px;
    background-color: white;
    border-radius: 50%;
    opacity: 0.8;
    pointer-events: none;
    animation: fall linear forwards;
}

@keyframes scaleUp {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fall {
    to { transform: translateY(110vh); }
}

/* Enhancing the pulse animation for the text */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}



/* --- Search Modal Styling --- */

/* Match the 'Copy Gift' dropdown style */
#search-input {
    width: 100%;
    height: 48px; /* Taller, comfortable touch target */
    padding: 0 15px;
    font-size: 1.2rem; /* Larger font matching the copy dropdown */
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #fff;
    /* Subtle shadow gives it the "texture" or depth look */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
    font-family: var(--font-primary);
    transition: all 0.2s;
    color: #333;
}

#search-input:focus {
    border-color: var(--green-dark);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);

}

#search-input::placeholder {
    color: #999;
    font-size: 1rem;
    font-weight: 400;
}

/* Ensure the results list has nice spacing below the new input */
#search-results-list {
    margin-top: 20px;
}

/* =========================================
   STATIC GOLD GRADIENT MODAL EDGE
   ========================================= */

.modal-content {
    /* Create a transparent border to act as a "window" for the gradient */
    border: 2px solid transparent;
    
    /* Set up two background layers: the solid content and the static gradient */
    background:
        linear-gradient(var(--off-white), var(--off-white)),
        linear-gradient(100deg, #a87b2a, #f3e083 50%, #d3a445);

    /* Use background-clip to make the gradient only visible through the border */
    background-clip: content-box, border-box;
    
    /* Ensure backgrounds originate from the same point for alignment */
    background-origin: border-box;

    /* Keep existing properties for a clean look */
    position: relative; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border-radius: 18px;
}

/* Ensure the old ::before pseudo-element is gone, just in case */
.modal-content::before {
    display: none;
    content: none;
}


