/* ===== Age Calculator - Modern Styles ===== */

/* Layout */
.age-layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
.age-main { min-width: 0; }
.age-card {
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 18px;
  padding: 32px; box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
.age-sidebar { display: flex; flex-direction: column; gap: 20px; }

/* Input form */
.age-form { margin-bottom: 28px; }
.age-form-row { display: flex; gap: 16px; align-items: end; }
.age-form-group { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.age-form-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.age-form-group input[type="date"] {
  width: 100%; padding: 14px 16px; border: 2px solid var(--border-light); border-radius: 12px;
  font-size: 16px; background: var(--bg); color: var(--text);
  outline: none; transition: all 0.2s ease; font-family: inherit;
}
.age-form-group input[type="date"]:focus {
  border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}
body[data-theme="dark"] .age-form-group input[type="date"] {
  background: var(--bg-muted); border-color: var(--border);
}

.age-btn {
  padding: 14px 28px; background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff; border: none; border-radius: 12px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all 0.25s ease; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 10px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}
.age-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4); }
.age-btn:active { transform: translateY(0); }

/* 4 mini cards */
.age-grid-4 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px;
}
.age-card-mini {
  text-align: center; padding: 20px 12px;
  background: var(--bg-soft); border-radius: 14px; border: 1px solid var(--border-light);
  transition: transform 0.2s ease;
}
.age-card-mini:hover { transform: translateY(-3px); }
.age-card-icon {
  width: 42px; height: 42px; margin: 0 auto 10px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff;
}
.age-card-icon.cake { background: linear-gradient(135deg, #ec4899, #f472b6); }
.age-card-icon.clock { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.age-card-icon.star { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.age-card-icon.dragon { background: linear-gradient(135deg, #ef4444, #f43f5e); }
.age-card-val { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.age-card-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* Section */
.age-section { margin-bottom: 20px; }
.age-section-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.age-section-title i { color: var(--primary); font-size: 15px; }

/* Stats grid */
.age-stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.age-stat-item {
  text-align: center; padding: 18px 10px;
  background: var(--bg-soft); border-radius: 12px; border: 1px solid var(--border-light);
}
.age-stat-num {
  display: block; font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 4px;
}
.age-stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* Progress bar */
.age-progress-wrap { padding: 20px; background: var(--bg-soft); border-radius: 14px; border: 1px solid var(--border-light); }
.age-progress-info { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--text-secondary); }
.age-progress-info #progress-label { font-weight: 700; color: var(--primary); font-size: 18px; }
.age-progress-bar { height: 10px; background: var(--bg-muted); border-radius: 10px; overflow: hidden; }
.age-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #8b5cf6); border-radius: 10px; transition: width 0.6s ease; }

/* Error */
.error-msg { padding: 14px 18px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; color: #dc2626; font-size: 14px; font-weight: 500; margin-top: 16px; }
body[data-theme="dark"] .error-msg { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #fca5a5; }

/* Sidebar (shared patterns) */
.sidebar-section { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 16px; padding: 20px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
.sidebar-header { text-align: center; padding: 28px 20px !important; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; border-color: transparent !important; }
.sidebar-header h1 { font-size: 1.35rem; font-weight: 800; color: #fff; margin-bottom: 6px; text-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.sidebar-header p { font-size: 0.82rem; color: rgba(255,255,255,0.85); }
body[data-theme="dark"] .sidebar-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; }
.sidebar-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.sidebar-title i { color: var(--primary); font-size: 0.9rem; }
.sidebar-tools { display: flex; flex-direction: column; gap: 8px; }
.sidebar-tool { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; transition: all 0.2s ease; text-decoration: none; background: var(--bg-soft); }
.sidebar-tool:hover { background: var(--primary-50); transform: translateX(3px); }
.sidebar-tool-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 16px; flex-shrink: 0; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.sidebar-tool-info { flex: 1; min-width: 0; }
.sidebar-tool-name { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.sidebar-tool-desc { font-size: 0.78rem; color: var(--text-muted); }
.ad-placeholder { width: 300px; height: 250px; flex-shrink: 0; margin: 0 auto; background: var(--bg-card); border: 2px dashed var(--border); border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--text-muted); font-size: 0.82rem; line-height: 1.5; }
.ad-placeholder .ad-icon { font-size: 1.8rem; color: var(--text-muted); margin-bottom: 10px; opacity: 0.4; }
.ad-placeholder .ad-label { font-weight: 600; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.ad-placeholder .ad-size { font-size: 0.75rem; color: var(--text-muted); opacity: 0.6; }

/* Dark mode */
body[data-theme="dark"] .age-card { background: var(--bg-card); border-color: var(--border); }
body[data-theme="dark"] .sidebar-section { background: var(--bg-card); border-color: var(--border); }
body[data-theme="dark"] .sidebar-tool { background: var(--bg-muted); }
body[data-theme="dark"] .sidebar-tool:hover { background: var(--primary-50); }
body[data-theme="dark"] .ad-placeholder { background: var(--bg-card); border-color: var(--border); }
body[data-theme="dark"] .age-card-mini { background: var(--bg-muted); border-color: var(--border); }
body[data-theme="dark"] .age-stat-item { background: var(--bg-muted); border-color: var(--border); }
body[data-theme="dark"] .age-progress-wrap { background: var(--bg-muted); border-color: var(--border); }

/* Responsive */
@media (max-width: 1024px) { .age-layout { grid-template-columns: 1fr 280px; gap: 20px; } }
@media (max-width: 860px) { .age-layout { grid-template-columns: 1fr; } .age-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } }
@media (max-width: 768px) {
  .age-form-row { flex-direction: column; }
  .age-btn { width: 100%; justify-content: center; }
  .age-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .age-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .age-card { padding: 20px; }
}
@media (max-width: 640px) { .age-sidebar { grid-template-columns: 1fr; } }