/* ===== Calculator Layout ===== */

.calc-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: stretch;
}

.calc-main {
  min-width: 0;
}

.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 2px 4px 0 rgb(15 23 42 / 0.08), 0 10px 25px -5px rgb(15 23 42 / 0.08), 0 1px 3px 0 rgb(79 70 229 / 0.05);
  max-width: 480px;
  margin: 0 auto;
}

.calc-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== Sidebar Components ===== */

.sidebar-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.sidebar-header {
  text-align: center;
  padding: 24px 16px !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;
}

body[data-theme="dark"] .sidebar-header h1 {
  color: #fff;
}

body[data-theme="dark"] .sidebar-header p {
  color: rgba(255,255,255,0.85);
}

.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;
}

.sidebar-tool-icon.calc { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.sidebar-tool-icon.age { background: linear-gradient(135deg, #ec4899, #f472b6); 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);
}

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);
}

/* ===== Ad Placeholder ===== */
.ad-placeholder {
  width: 300px;
  height: 250px;
  flex-shrink: 0;
  margin: 0 auto;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: 14px;
  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;
}

body[data-theme="dark"] .ad-placeholder {
  background: var(--bg-card);
  border-color: var(--border);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .calc-layout {
    grid-template-columns: 1fr 280px;
    gap: 20px;
  }
}

@media (max-width: 860px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }

  .calc-sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .calc-card {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .calc-sidebar {
    grid-template-columns: 1fr;
  }
}

/* ===== Original Calculator Styles ===== */

.calc-display {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: right;
  margin-bottom: 18px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}

.calc-history {
  font-size: 14px;
  color: #94a3b8;
  min-height: 18px;
  word-break: break-all;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.calc-current {
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  word-break: break-all;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  line-height: 1.2;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.calc-btn {
  height: 58px;
  border: none;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  user-select: none;
}

.calc-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  background: var(--border-light);
}

.calc-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.calc-btn.func {
  background: var(--primary-50);
  color: var(--primary);
  font-size: 15px;
  font-weight: 600;
}

.calc-btn.func:hover {
  background: var(--primary-100);
}

.calc-btn.op {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 700;
}

.calc-btn.op:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.calc-btn.equals {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
}

.calc-btn.equals:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.calc-btn.warn {
  background: #fef3c7;
  color: #d97706;
}

.calc-btn.warn:hover {
  background: #fde68a;
}

body[data-theme="dark"] .calc-btn {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
}
body[data-theme="dark"] .calc-btn:hover {
  background: #334155;
}
body[data-theme="dark"] .calc-btn.func {
  background: #312e81;
  color: #a5b4fc;
  border: 1px solid #4338ca;
}
body[data-theme="dark"] .calc-btn.func:hover {
  background: #4338ca;
}
body[data-theme="dark"] .calc-btn.warn {
  background: #78350f;
  color: #fbbf24;
  border: 1px solid #92400e;
}
body[data-theme="dark"] .calc-btn.warn:hover {
  background: #92400e;
}
body[data-theme="dark"] .calc-btn.op {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
}
body[data-theme="dark"] .calc-btn.op:hover {
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}
body[data-theme="dark"] .calc-btn.equals {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
}
body[data-theme="dark"] .calc-btn.equals:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}
body[data-theme="dark"] .tool-card-box {
  background: var(--bg-card);
}

/* ===== SEO Content ===== */
.calc-seo {
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.calc-seo p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.calc-seo p:last-child {
  margin-bottom: 0;
}

.calc-seo kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.78rem;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--border);
  line-height: 1.4;
  color: var(--text);
}

body[data-theme="dark"] .calc-seo {
  background: var(--bg-card);
  border-color: var(--border);
}

body[data-theme="dark"] .calc-seo kbd {
  background: var(--bg-muted);
  border-color: var(--border);
  box-shadow: 0 1px 0 var(--border);
  color: var(--text);
}

@media (max-width: 480px) {
  .calc-btn { height: 52px; font-size: 16px; }
  .calc-current { font-size: 36px; }
  .tool-card-box { padding: 20px !important; }
}
