/* --- 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 --- */
.app-loading { visibility: hidden; }
#app-wrapper { height: 100vh; background-color: var(--off-white); overflow-y: auto; -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: flex-start; align-items: center; gap: 15px;
    flex-shrink: 0; border-bottom: 1px solid rgba(0,0,0,0.05);
}
.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; }

#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; }
#totals-bar { border-top: 1px solid rgba(0,0,0,0.05); }
.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: right; }
#toggle-prices-btn { border: none; background: none; cursor: pointer; color: var(--green-dark); padding: 5px; }
#toggle-prices-btn i { font-size: 1rem; }

/* --- 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: 12px 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 { text-decoration: line-through; 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 --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); 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; box-shadow: var(--shadow); border: none;
    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.8rem; 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:empty::after { content: '—'; color: #999; }
.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-modal .modal-content { max-width: 500px; }
#stats-modal .modal-footer { justify-content: center; }
.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: center; }
.stats-breakdown-group h4 .price-value { font-family: var(--font-primary); font-size: 0.8rem; color: var(--text-color); font-weight: 700; }
.stats-breakdown-group h4 .stats-count { font-family: var(--font-primary); font-size: 0.8rem; color: #888; margin-left: 8px; font-weight: 500; }
.stats-breakdown-list { list-style: none; padding-left: 10px; margin-bottom: 15px; }
.stats-breakdown-item { display: flex; align-items: center; padding: 5px 0; gap: 8px; font-size: 0.9rem; }
.stats-breakdown-item .gift-name { flex-grow: 1; }
.stats-breakdown-item .kid-name-badge { font-size: 0.7rem; background: #eee; padding: 2px 6px; border-radius: 4px; color: #555; }
.stats-breakdown-item .status-icon { font-size: 1rem; } /* Make modal icons slightly smaller */
.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; }
}

/* --- Calculator Feature --- */
#calculator-btn i {
    font-size: 1.1rem;
    color: var(--green-dark);
}

/* 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: 15px;
    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;
}
