/* ═══════════════════════════════════════════════════════════════
   AGE CALCULATOR TOOL — STYLESHEET
   Supports Manual Age Calculation & Bulk CSV Auto-Mapping
   ═══════════════════════════════════════════════════════════════ */

/* ── Container Layout ── */
.age-calculator-wrapper {
  width: 100%;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  min-height: 85vh;
  display: flex;
  flex-direction: column;
}



.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--purple-500);
  text-decoration: none;
  margin-bottom: 12px;
  transition: opacity var(--transition-fast);
}

.back-link:hover {
  opacity: 0.8;
}

/* ── Mode Switcher Tabs ── */
.mode-tabs-container {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 0 0 24px 0;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.mode-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.mode-tab:hover {
  color: var(--purple-500);
  background: rgba(124, 58, 237, 0.05);
}

.mode-tab.active {
  background: var(--purple-500);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.mode-tab.active .icon {
  background-color: #ffffff;
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Main Calculator Card ── */
.age-calculator-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
  box-sizing: border-box;
}

/* ── Form Controls ── */
.calculator-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-grid-two {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.unified-date-picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 48px;
  gap: 10px;
  align-items: flex-end;
}

.date-part-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sub-part-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.custom-combobox {
  position: relative;
  width: 100%;
}

.custom-combobox.active-combobox {
  z-index: 100;
}

.combobox-input-field {
  width: 100%;
  padding-right: 38px !important;
  border-radius: 8px;
}

.combobox-arrow-btn {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 32px;
  height: calc(100% - 2px);
  background: rgba(139, 92, 246, 0.06);
  border: none;
  border-left: 1.5px solid var(--border);
  color: transparent;
  font-size: 0;
  cursor: pointer;
  border-radius: 0 7px 7px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  padding: 0;
  margin: 0;
  z-index: 2;
  overflow: hidden;
}

.combobox-arrow-btn::after {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.combobox-arrow-btn:hover {
  background: rgba(139, 92, 246, 0.14);
}

.combobox-arrow-btn:hover::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236d28d9' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.custom-combobox.active-combobox .combobox-arrow-btn {
  background: rgba(139, 92, 246, 0.20);
  border-left-color: var(--purple-500);
}

.custom-combobox.active-combobox .combobox-arrow-btn::after {
  transform: rotate(180deg);
}

/* Custom Dropdown Menu Positioned STRICTLY BELOW the Input Box */
.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 220px;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--purple-400) transparent;
  background: var(--bg-card);
  border: 1.5px solid var(--purple-500);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(139, 92, 246, 0.12);
  z-index: 99999;
  display: none;
  padding: 6px 0;
}

/* Right-align Year combobox dropdowns to prevent clipping on right edge */
#combobox-year .custom-dropdown-menu,
#combobox-target-year .custom-dropdown-menu,
#combobox-bulk-custom-target-year .custom-dropdown-menu {
  left: auto;
  right: 0;
}

/* Custom Sleek Scrollbar */
.custom-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--purple-400);
  border-radius: var(--radius-full);
}

.custom-dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: var(--purple-500);
}

.custom-dropdown-menu.show-menu {
  display: block;
  animation: dropdownSlideDown 0.18s ease;
}

@keyframes dropdownSlideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: rgba(139, 92, 246, 0.10);
  color: var(--purple-600);
}

.dropdown-item.selected {
  background: rgba(124, 58, 237, 0.18);
  color: var(--purple-600);
  font-weight: 800;
  border-left: 3.5px solid var(--purple-600);
}

.date-picker-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
}

.picker-trigger-box {
  position: relative;
  width: 100%;
  height: 48px;
}

.calendar-picker-btn {
  width: 100%;
  height: 100%;
  background: var(--purple-500);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 1.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.calendar-picker-btn:hover {
  transform: translateY(-2px);
  background: var(--purple-600);
  box-shadow: var(--shadow-md);
}

.hidden-date-picker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.required-star {
  color: #ef4444;
}

.optional-tag {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.input-field-wrapper {
  position: relative;
  width: 100%;
}

.form-control-input {
  width: 100%;
  padding: 14px 18px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.form-control-input:focus {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-hint-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.label-with-checkbox {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Custom Checkbox */
.custom-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  line-height: 1;
  vertical-align: middle;
}

.custom-checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-box {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  border: 2px solid var(--purple-400);
  border-radius: 4px;
  background: var(--bg-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  position: relative;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.checkbox-box::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  margin-bottom: 2px;
  opacity: 0;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.custom-checkbox-label input[type="checkbox"]:checked + .checkbox-box {
  background: var(--purple-500);
  border-color: var(--purple-500);
}

.custom-checkbox-label input[type="checkbox"]:checked + .checkbox-box::after {
  transform: rotate(45deg) scale(1);
  opacity: 1;
}

/* Protocol Alert Box */
.protocol-box {
  background: var(--bg-primary);
  border: 1.5px solid rgba(124, 58, 237, 0.18);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.protocol-checkbox {
  align-items: flex-start;
  gap: 12px;
}

.protocol-checkbox .checkbox-box {
  margin-top: 2px;
}

.protocol-title {
  font-family: var(--font-heading);
  font-size: 0.98rem;
  color: var(--text-primary);
  display: block;
  margin-bottom: 2px;
}

.protocol-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Actions Row */
.form-actions-row {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.btn-primary-calc {
  background: var(--gradient-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 28px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.btn-primary-calc:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary-calc {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 24px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.btn-secondary-calc:hover {
  border-color: var(--purple-500);
  background: var(--bg-tertiary);
}

/* ── Results Display ── */
.results-wrapper {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: fadeIn 0.4s ease;
}

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

.result-hero-card {
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  color: #ffffff;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.hero-label {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
  margin-bottom: 10px;
}

.hero-age-value {
  font-family: var(--font-heading);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.hero-birthday-status {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
}

/* Live Real-Time Ticking Cards */
.live-countdowns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.live-countdown-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.live-card-header {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--purple-600);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pulse-dot {
  width: 9px;
  height: 9px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.live-card-box {
  background: var(--bg-primary);
  border: 1.5px solid var(--purple-400);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: center;
}

.live-timer-text {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--purple-600);
  letter-spacing: 0.02em;
}

/* Summary Grid */
.metrics-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-card {
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--purple-500);
}

.metric-icon-wrap {
  font-size: 1.5rem;
  line-height: 1;
}

.metric-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-title {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* ── BULK TAB STYLES ── */
.bulk-options-bar {
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.bulk-dropzone {
  border: 2.5px dashed var(--purple-400);
  background: rgba(139, 92, 246, 0.04);
  border-radius: var(--radius-lg);
  padding: 44px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bulk-dropzone:hover, .bulk-dropzone.drag-over {
  background: rgba(139, 92, 246, 0.08);
  border-color: var(--purple-500);
}

.bulk-dropzone-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.bulk-dropzone-sub {
  font-size: 0.98rem;
  color: var(--text-secondary);
}

.bulk-browse-btn {
  background: none;
  border: none;
  color: var(--purple-500);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.bulk-mobile-browse-btn {
  display: none;
}

.bulk-dropzone-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-bulk-sample {
  margin-top: 8px;
  background: var(--bg-card);
  color: var(--purple-500);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all var(--transition-fast);
}

.btn-bulk-sample:hover {
  border-color: var(--purple-500);
  background: var(--bg-tertiary);
}

/* Bulk Processing Panel */
.bulk-processing-panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: fadeIn 0.4s ease;
}

.panel-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.panel-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

/* Clear CSV Button (Proper Danger/Red Theme) */
.btn-clear-csv-btn {
  height: 38px;
  padding: 0 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border: 1.5px solid rgba(239, 68, 68, 0.35);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-clear-csv-btn .icon {
  background-color: #dc2626;
  transition: background-color var(--transition-fast);
}

.btn-clear-csv-btn:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
  transform: translateY(-1px);
}

.btn-clear-csv-btn:hover .icon {
  background-color: #ffffff;
}

[data-theme="dark"] .btn-clear-csv-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.45);
}

[data-theme="dark"] .btn-clear-csv-btn .icon {
  background-color: #f87171;
}

[data-theme="dark"] .btn-clear-csv-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

[data-theme="dark"] .btn-clear-csv-btn:hover .icon {
  background-color: #ffffff;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.15);
  color: var(--purple-600);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
  width: max-content;
}

/* Mapping Table Card */
.mapping-table-card {
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.mapping-table-header h4 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.mapping-table-header p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.mapping-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mapping-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  gap: 20px;
}

.mapping-field-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.field-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.mapping-select-wrap {
  width: 240px;
}

.custom-select-control {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  cursor: pointer;
}

.custom-select-control:focus {
  border-color: var(--purple-500);
}

/* ── Bulk Custom Target Date Wrapper & Header ── */
.bulk-custom-target-date-wrapper {
  margin-top: 8px;
  padding: 14px 16px;
  background: rgba(139, 92, 246, 0.07);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

[data-theme="dark"] .bulk-custom-target-date-wrapper {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.28);
}

.bulk-custom-target-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.bulk-custom-target-title {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bulk-custom-cal-trigger {
  width: 38px;
  height: 38px;
  position: relative;
  flex-shrink: 0;
}

.bulk-custom-cal-trigger .calendar-picker-btn {
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  border-radius: 6px;
}

.bulk-target-inputs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

/* Table Preview Card */
.table-preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-card-header {
  padding: 18px 24px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-card-header h4 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.table-responsive-container {
  width: 100%;
  overflow-x: auto;
  max-height: 440px;
  -webkit-overflow-scrolling: touch;
}

.preview-data-table {
  width: 100%;
  min-width: 500px;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.9rem;
}

.preview-data-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
}

.preview-data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  text-align: center;
}

.preview-data-table tbody tr:hover {
  background: rgba(139, 92, 246, 0.04);
}

.age-badge-highlight {
  display: inline-block;
  background: rgba(124, 58, 237, 0.12);
  color: var(--purple-600);
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.status-badge-done {
  color: #10b981;
  font-weight: 700;
}

.status-badge-pending {
  color: #f59e0b;
  font-weight: 700;
}

/* Age Format Header Select Styling */
.th-age-header-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 0;
}

.th-age-title {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.age-format-select {
  display: inline-block;
  width: auto;
  min-width: 140px;
  font-family: var(--font-body, inherit);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 30px 6px 12px;
  border-radius: var(--radius-sm, 8px);
  border: 1.5px solid rgba(139, 92, 246, 0.35);
  background-color: var(--bg-card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--purple-600);
  cursor: pointer;
  outline: none;
  text-transform: none;
  letter-spacing: normal;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-shadow: 0 1px 3px rgba(139, 92, 246, 0.08);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.age-format-select:hover {
  border-color: var(--purple-500);
  background-color: rgba(139, 92, 246, 0.06);
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.15);
}

.age-format-select:focus {
  border-color: var(--purple-600);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.age-format-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  padding: 8px 12px;
}

/* Utilities */
.hidden-element {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE STYLES (TABLET & MOBILE)
   ═══════════════════════════════════════════════════════════════ */

/* Tablet Optimization (<= 900px) */
@media (max-width: 900px) {
  .age-calculator-card {
    padding: 28px 22px;
  }

  .form-grid-two {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .metrics-summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .panel-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .panel-actions-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 10px;
  }

  .btn-clear-csv-btn {
    width: auto !important;
    height: 34px;
    padding: 0 12px;
    font-size: 0.82rem;
    border-radius: 5px;
    flex-shrink: 0;
  }

  .btn-clear-csv-btn .icon {
    width: 13px;
    height: 13px;
  }

  .bulk-dropzone-title,
  .bulk-dropzone-sub {
    display: none !important;
  }

  .bulk-mobile-browse-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 700;
    width: auto;
    max-width: 280px;
    height: 44px;
    border-radius: 8px;
    box-sizing: border-box;
    cursor: pointer;
    margin: 4px auto;
    box-shadow: var(--shadow-sm);
  }
}

/* Mobile Optimization (<= 640px) */
@media (max-width: 640px) {
  .panel-title {
    font-size: 1.15rem;
  }

  .mapping-table-header h4,
  .table-card-header h4 {
    font-size: 0.98rem;
  }

  .field-name {
    font-size: 0.88rem;
  }

  .field-desc {
    font-size: 0.78rem;
  }

  .age-calculator-card {
    padding: 18px 14px;
    border-radius: var(--radius-md);
  }

  .mode-tabs-container {
    gap: 4px;
    padding: 4px;
    max-width: 100%;
    width: 100%;
    margin: 0 0 20px 0;
    box-sizing: border-box;
  }

  .mode-tab {
    padding: 10px 6px;
    font-size: 0.82rem;
    gap: 5px;
    min-width: 0;
    white-space: nowrap;
    text-align: center;
  }

  .mode-tab .icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
  }

  .unified-date-picker-row {
    grid-template-columns: 1fr 1fr 1fr 42px;
    gap: 6px;
  }


  .form-control-input,
  .combobox-input-field,
  .custom-select-control,
  .calendar-picker-btn {
    padding: 10px 8px;
    font-size: 0.88rem;
    height: 42px;
    border-radius: 5px;
  }

  .combobox-input-field {
    padding-right: 32px !important;
  }

  .combobox-arrow-btn {
    width: 26px;
    border-radius: 0 4px 4px 0;
  }

  .combobox-arrow-btn::after {
    width: 10px;
    height: 10px;
  }

  .picker-trigger-box {
    width: 100%;
    height: 42px;
  }

  .calendar-picker-btn {
    font-size: 1.1rem;
    border-radius: 5px;
  }

  .sub-part-label {
    font-size: 0.65rem;
  }

  .form-actions-row {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .btn-primary-calc, .btn-secondary-calc {
    width: 100%;
    padding: 12px 18px;
    font-size: 0.92rem;
  }

  .result-hero-card {
    padding: 20px 14px;
  }

  .hero-age-value {
    font-size: 1.65rem;
    word-break: break-word;
  }

  .hero-status-pill {
    font-size: 0.8rem;
    padding: 4px 12px;
  }

  .live-countdowns-grid {
    grid-template-columns: 1fr;
  }

  .live-countdown-card {
    padding: 14px;
  }

  .live-timer-text {
    font-size: 1.2rem;
  }

  .bulk-dropzone {
    padding: 20px 14px;
    gap: 10px;
  }

  .bulk-mobile-browse-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    max-width: 100%;
    height: 42px;
    font-size: 0.92rem;
    border-radius: 6px;
    padding: 10px 16px;
    margin: 2px 0;
  }

  .mapping-table-card {
    padding: 14px 10px;
  }

  .mapping-table-header p {
    margin-bottom: 8px;
  }

  .mapping-grid {
    gap: 8px;
  }

  .mapping-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 10px;
  }

  .mapping-select-wrap {
    width: 100%;
  }

  .bulk-custom-target-date-wrapper {
    padding: 10px 10px;
    border-radius: 8px;
    gap: 10px;
  }

  .bulk-custom-cal-trigger {
    width: 32px;
    height: 32px;
  }

  .bulk-custom-cal-trigger .calendar-picker-btn {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    border-radius: 5px;
  }

  .bulk-target-inputs-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .panel-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .panel-actions-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 8px;
  }

  .btn-clear-csv-btn {
    width: auto !important;
    height: 32px;
    padding: 0 10px;
    font-size: 0.78rem;
    border-radius: 5px;
    flex-shrink: 0;
  }

  .btn-clear-csv-btn .icon {
    width: 12px;
    height: 12px;
  }

  .table-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }

  .preview-data-table th,
  .preview-data-table td {
    padding: 8px 6px;
    font-size: 0.78rem;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    word-break: normal;
  }

  .age-badge-highlight {
    font-size: 0.76rem;
    padding: 3px 8px;
  }

  .age-format-select {
    font-size: 0.72rem;
    padding: 4px 22px 4px 8px;
    min-width: 115px;
    border-radius: 5px;
  }

  .calendar-picker-btn.bulk-full-cal-btn {
    border-radius: 5px;
  }

  #btn-download-bulk-csv {
    width: 100%;
  }

  .custom-dropdown-menu {
    max-height: 180px;
    border-radius: 6px;
  }
}

/* Extra Small Mobile Devices (<= 420px) */
@media (max-width: 420px) {
  .mode-tabs-container {
    gap: 3px;
    padding: 3px;
  }

  .mode-tab {
    padding: 9px 4px;
    font-size: 0.76rem;
    gap: 4px;
    letter-spacing: -0.01em;
  }

  .mode-tab .icon {
    width: 13px;
    height: 13px;
  }

  .metrics-summary-grid {
    grid-template-columns: 1fr;
  }

  .hero-age-value {
    font-size: 1.45rem;
  }

  .unified-date-picker-row {
    gap: 4px;
  }

  .bulk-target-inputs-row {
    gap: 4px;
  }

  .form-control-input {
    padding: 8px 6px;
    font-size: 0.82rem;
  }
}
