/* ============================================
   Case Converter - Layout & Styles

   Breakpoints:
     Mobile:    < 768px   (stacked, scrollable)
     Tablet:    768-1023px (stacked, no ads)
     Desktop:   1024-1399px (full, no ads)
     Wide:      >= 1400px  (full + ad sidebars)
   ============================================ */

/* ======================
   BASE LAYOUT
   ====================== */

html {
  background-color: #0d9488;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ======================
   HEADER
   ====================== */

.header {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: var(--space-3) 0;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.header-content {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.logo-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.logo-text { color: white; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); }

.logo-dot {
  color: #fbbf24;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

.title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ======================
   TOOLBAR
   ====================== */

.toolbar {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.toolbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.toolbar-hint {
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Toolbar buttons */
.toolbar-right .btn {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: var(--font-semibold);
}

.toolbar-right .btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.toolbar-right .btn-primary {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.5);
}

.toolbar-right .btn-primary:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ======================
   PAGE BODY
   ====================== */

.page-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "content";
  position: relative;
  z-index: 1;
}

/* ======================
   AD SIDEBARS
   ====================== */

.ad-sidebar {
  display: none;
  align-self: start;
  padding: var(--space-4) 0;
}

.ad-sidebar-left  { grid-area: ad-left;  justify-self: center; }
.ad-sidebar-right { grid-area: ad-right; justify-self: center; }

.ad-sticky { position: sticky; top: var(--space-4); }

.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 160px;
  height: 600px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.4;
}

/* ======================
   MAIN CONTENT
   ====================== */

.main-content {
  grid-area: content;
  display: flex;
  flex-direction: column;
  padding: var(--space-6) 0;
}

/* ======================
   CASE CARD
   ====================== */

.case-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: box-shadow var(--transition-base);
  margin-bottom: var(--space-6);
}

.case-card:hover {
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* ======================
   MODE BUTTONS
   ====================== */

.mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(15, 118, 110, 0.08));
  border-bottom: 1px solid var(--color-border);
}

.mode-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid rgba(13, 148, 136, 0.3);
  background: rgba(13, 148, 136, 0.08);
  color: var(--color-gray-700);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.mode-btn:hover {
  background: rgba(13, 148, 136, 0.18);
  border-color: rgba(13, 148, 136, 0.5);
  color: var(--color-gray-900);
  transform: translateY(-1px);
}

.mode-btn.active {
  background: linear-gradient(135deg, #0d9488, #0f766e);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}

/* ======================
   INPUT / OUTPUT AREAS
   ====================== */

.io-areas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 280px;
}

.io-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.io-panel:first-child {
  border-right: 1px solid var(--color-border);
}

.io-panel-header {
  padding: var(--space-2) var(--space-4);
  background: var(--color-gray-50);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.io-panel-label {
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.io-textarea {
  flex: 1;
  width: 100%;
  resize: none;
  border: none;
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-gray-900);
  background: transparent;
  min-height: 260px;
}

.io-textarea:focus {
  outline: none;
  box-shadow: none;
}

.io-textarea[readonly] {
  color: var(--color-gray-700);
  background: rgba(13, 148, 136, 0.02);
  cursor: default;
}

/* ======================
   STATS BAR
   ====================== */

.stats-bar {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-3) var(--space-5);
  background: var(--color-gray-50);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.stats-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stats-label {
  font-weight: var(--font-medium);
  color: var(--color-gray-500);
}

.stats-item span:last-child {
  font-weight: var(--font-semibold);
  color: var(--color-gray-800);
  font-variant-numeric: tabular-nums;
}

/* ======================
   INFO SECTION (uses common.css defaults)
   ====================== */

.info-section .container {
  padding: 0;
}

.info-section p:last-child {
  margin-bottom: 0;
}

/* ======================
   RELATED TOOLS
   ====================== */

.related-section {
  margin-bottom: var(--space-8);
}

.related-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-4);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.related-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--transition-base);
}

.related-card:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.related-icon {
  font-size: var(--text-2xl);
  line-height: 1;
  flex-shrink: 0;
  width: 2.5rem;
  text-align: center;
  font-family: var(--font-mono);
}

.related-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: white;
  margin-bottom: var(--space-1);
}

.related-desc {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.75);
}

/* ======================
   STATUS BAR
   ====================== */

.status-bar {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding: var(--space-2) 0;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.status-content {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-size: var(--text-sm);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.status-label {
  color: rgba(255, 255, 255, 0.8);
  font-weight: var(--font-medium);
}

#status-words,
#status-chars,
#status-mode {
  color: white;
  font-weight: var(--font-semibold);
}

/* ============================================
   RESPONSIVE: Wide Desktop (>= 1400px)
   ============================================ */

@media (min-width: 1400px) {
  .page-body {
    grid-template-columns: 200px 1fr 200px;
    grid-template-areas: "ad-left content ad-right";
  }

  .ad-sidebar { display: block; }
}

/* ============================================
   RESPONSIVE: Tablet 768-1023px
   ============================================ */

@media (max-width: 1023px) {
  .related-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================
   RESPONSIVE: Mobile (< 768px)
   ============================================ */

@media (max-width: 767px) {
  body {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .header { padding: var(--space-2) 0; }

  .title { font-size: var(--text-sm); }

  .logo-link {
    font-size: var(--text-sm);
    padding: var(--space-1) var(--space-2);
  }

  .main-content { padding: var(--space-4) 0; }

  .mode-buttons {
    padding: var(--space-3);
    gap: var(--space-1);
  }

  .mode-btn {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
  }

  .io-areas {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .io-panel:first-child {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .io-textarea {
    min-height: 160px;
  }

  .stats-bar {
    gap: var(--space-3);
    flex-wrap: wrap;
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-3);
  }

  .stats-mode { width: 100%; }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .status-bar { padding: var(--space-1) 0; }

  .status-content { gap: var(--space-2); font-size: var(--text-xs); }
}

/* ============================================
   DARK MODE
   ============================================ */

html[data-theme="dark"] { background-color: #0f172a; }

[data-theme="dark"] body {
  background: #0f172a;
}

[data-theme="dark"] .header {
  background: rgba(0, 0, 0, 0.3);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .toolbar {
  background: rgba(0, 0, 0, 0.2);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .case-card {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .case-card:hover {
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .mode-buttons {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.06), rgba(15, 118, 110, 0.06));
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .mode-btn {
  border-color: rgba(13, 148, 136, 0.25);
  background: rgba(13, 148, 136, 0.06);
  color: var(--color-gray-300);
}

[data-theme="dark"] .mode-btn:hover {
  background: rgba(13, 148, 136, 0.15);
  color: var(--color-gray-100);
}

[data-theme="dark"] .mode-btn.active {
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: white;
}

[data-theme="dark"] .io-panel-header {
  background: rgba(255, 255, 255, 0.04);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .io-panel:first-child {
  border-right-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .io-textarea {
  color: var(--color-gray-100);
}

[data-theme="dark"] .io-textarea[readonly] {
  color: var(--color-gray-300);
  background: rgba(13, 148, 136, 0.03);
}

[data-theme="dark"] .io-textarea::placeholder {
  color: var(--color-gray-600);
}

[data-theme="dark"] .stats-bar {
  background: rgba(255, 255, 255, 0.03);
  border-top-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .stats-item span:last-child {
  color: var(--color-gray-200);
}

[data-theme="dark"] .status-bar {
  background: rgba(0, 0, 0, 0.3);
  border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .ad-placeholder {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.12);
}

/* ── About/Related fix: allow scrolling past tool UI ─────────────────────── */
.main-content { overflow-y: auto; }

/* ── Compact header ─────────────────────────────────────────────────────── */
.header { padding: var(--space-1) 0; }
.logo-link { font-size: var(--text-sm); padding: var(--space-1) var(--space-2); }
.title { font-size: var(--text-sm); }

/* ── Mobile: natural page scroll ────────────────────────────────────────── */
@media (max-width: 767px) {
  body { height: auto; min-height: 100vh; overflow-y: auto; }
  .page-body { overflow: visible; }
  .main-content { overflow: visible !important; padding-bottom: var(--space-8); }
}
