/* ============================================================
   Utility Website — Modern Core Styles
   Inspired by clean, modern web aesthetics (Google-like)
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4285f4;
  --primary-dark: #3367d6;
  --primary-light: #e8f0fe;
  --primary-lighter: #f0f4ff;
  --bg: #f8f9fa;
  --bg-white: #ffffff;
  --card: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;
  --border: #dadce0;
  --border-light: #e8eaed;
  --success: #1e8e3e;
  --danger: #d93025;
  --warning: #fbbc04;
  --shadow-sm: 0 1px 2px rgba(60, 64, 67, 0.08);
  --shadow-md: 0 1px 3px rgba(60, 64, 67, 0.12), 0 1px 2px rgba(60, 64, 67, 0.08);
  --shadow-lg: 0 4px 12px rgba(60, 64, 67, 0.12);
  --shadow-xl: 0 8px 24px rgba(60, 64, 67, 0.16);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.35s ease;
}

body {
  font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================================
   Header
   ============================================================ */

header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

header .container {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

/* Utility page header — left-aligned logo */
header.header--utility .container {
  justify-content: flex-start;
}

/* Utility page header — match logo background color */
header.header--utility {
  background: #111827;
  padding: 4px 0;
}

/* Homepage header — left-aligned, larger logo */
header.header--home .container {
  justify-content: flex-start;
}

.logo {
  display: block;
  height: 40px;
  width: auto;
  transition: opacity var(--transition-fast);
}

.logo:hover {
  opacity: 0.85;
}

/* Homepage header logo — larger, left-aligned */
.logo--home {
  height: 52px;
}

/* Utility page header logo — larger, left-aligned */
.logo--utility {
  height: 64px;
}

/* Hide old text-based logo styling */
.logo::before {
  display: none;
}

/* ============================================================
   Main Content
   ============================================================ */

main {
  padding: 40px 0 60px;
  min-height: calc(100vh - 160px);
}

/* Utility page header (H1 + subtitle) */
.page-header {
  margin-bottom: 36px;
}

.page-header h1 {
  margin-bottom: 6px;
}

.page-header .subtitle {
  margin-bottom: 0;
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  text-align: center;
  padding: 30px 12px 24px;
  background: linear-gradient(180deg, #f0f4ff 0%, var(--bg) 100%);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  margin-bottom: 32px;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero-logo {
  display: block;
  margin: 0 auto 16px;
  max-width: 720px;
  width: 90%;
  height: auto;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

.hero-features {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.feature {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 8px 16px;
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.feature:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.feature-icon {
  font-size: 1rem;
}

/* ============================================================
   Category Sections
   ============================================================ */

.category-section {
  margin-bottom: 48px;
}

.category-section h2 {
  font-size: 1.4rem;
  font-weight: 500;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.category-icon {
  font-size: 1.4rem;
}

.category-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 600px;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ============================================================
   Utility Grid & Cards
   ============================================================ */

.utility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.utility-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-height: auto;
}

.utility-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.utility-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.utility-card h3 {
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.utility-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ============================================================
   Page Typography (H1, H2, Subtitles)
   ============================================================ */

h1 {
  font-size: 2rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 32px;
  line-height: 1.5;
}

h2 {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text);
  margin: 32px 0 10px;
  letter-spacing: -0.02em;
}

h2:first-child {
  margin-top: 0;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

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

strong {
  color: var(--text);
  font-weight: 600;
}

ul {
  margin: 8px 0 16px 20px;
  line-height: 1.8;
}

li {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ============================================================
   Forms — Modern Google-like Styling
   ============================================================ */

.card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.form-group {
  margin-bottom: 22px;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

textarea,
input[type="text"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-white);
  color: var(--text);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background var(--transition-normal);
  line-height: 1.5;
}

textarea {
  min-height: 240px;
  resize: vertical;
  font-family: 'Courier New', 'Fira Code', monospace;
  font-size: 1rem;
  line-height: 1.6;
  background: #fbfcfe;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15);
  background: var(--bg-white);
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input[type="date"] {
  cursor: pointer;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6368' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* ============================================================
   Buttons — Modern Google-like
   ============================================================ */

button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-normal), transform var(--transition-fast);
  font-family: inherit;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.5;
}

button:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-sm);
  transform: none;
}

button:active {
  transform: scale(0.98);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================================
   Results — Modern Styled Feedback
   ============================================================ */

.result {
  margin-top: 20px;
  padding: 18px;
  background: #e6f4ea;
  border: 1px solid #ceead6;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.6;
}

.error {
  margin-top: 20px;
  padding: 18px;
  background: #fce8e6;
  border: 1px solid #f5c6c4;
  border-radius: var(--radius-sm);
  color: var(--danger);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.6;
}

.result strong,
.error strong {
  color: var(--text);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  display: block;
}

.result pre,
.error pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================================
   Highlight invisible chars
   ============================================================ */

.highlight-invisible {
  background: #fef3c7;
  border-radius: 3px;
  padding: 0 1px;
  color: #92400e;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ============================================================
   Stats
   ============================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.stat-card {
  background: #f1f3f4;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   Inline Controls
   ============================================================ */

.inline-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

/* ============================================================
   Footer
   ============================================================ */

footer {
  background: var(--bg-white);
  border-top: 1px solid var(--border-light);
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-note {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  main {
    padding: 24px 0 40px;
  }

  .hero {
    padding: 40px 16px 32px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  h1 {
    font-size: 1.7rem;
  }

  h2 {
    font-size: 1.15rem;
  }

  .card {
    padding: 24px 20px;
  }

  .utility-card {
    padding: 20px;
    flex-direction: column;
  }

  .utility-icon {
    font-size: 1.6rem;
  }

  .utility-grid {
    gap: 12px;
  }

  textarea {
    min-height: 140px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.4rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .logo {
    height: 36px;
  }

  .logo--home {
    height: 44px;
  }

  .logo--utility {
    height: 28px;
  }

  .hero-logo {
    max-width: 240px;
  }

  .feature {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

/* ============================================================
   Animations
   ============================================================ */

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

.card {
  animation: fadeInUp 0.4s ease-out;
}

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

.result,
.error {
  animation: slideIn 0.25s ease-out;
}

/* ============================================================
   Scrollbar Styling
   ============================================================ */

textarea::-webkit-scrollbar,
::-webkit-scrollbar {
  width: 8px;
}

textarea::-webkit-scrollbar-track,
::-webkit-scrollbar-track {
  background: var(--bg);
}

textarea::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
