/* ============================================
   Tile Calculator UK — styles.css
   Professional blue/teal design, mobile-first
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #0891b2;
  --primary-dark: #0e7490;
  --primary-light: #06b6d4;
  --bg-light: #f0f9ff;
  --bg-white: #ffffff;
  --text-dark: #1e293b;
  --text-mid: #475569;
  --text-light: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  --success: #10b981;
  --success-light: #d1fae5;
  --error: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-dark);
  background: var(--bg-light);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-dark);
  line-height: 1.3;
  margin-bottom: 0.5em;
}
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; margin-top: 2rem; }
h3 { font-size: 1.25rem; font-weight: 600; margin-top: 1.5rem; }
h4 { font-size: 1.1rem; font-weight: 600; }

p { margin-bottom: 1rem; color: var(--text-mid); }
ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; color: var(--text-mid); }
li { margin-bottom: 0.35rem; }
strong { color: var(--text-dark); }

/* --- Header --- */
.site-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-dark);
  text-decoration: none;
}
.logo:hover { text-decoration: none; color: var(--text-dark); }
.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
}
.logo span { color: var(--primary); }

/* Desktop nav */
.nav-links {
  display: none;
  list-style: none;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}
.nav-links li a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--text-mid);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.nav-links li a:hover,
.nav-links li a.active {
  background: var(--bg-light);
  color: var(--primary);
  text-decoration: none;
}

/* Mobile menu toggle */
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-mid);
}
.menu-toggle:hover { background: var(--bg-light); }

/* Mobile nav */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-white);
  z-index: 99;
  overflow-y: auto;
  padding: 1rem;
  border-top: 1px solid var(--border);
}
.mobile-nav.open { display: block; }
.mobile-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.mobile-nav li a {
  display: block;
  padding: 0.85rem 1rem;
  color: var(--text-mid);
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
}
.mobile-nav li a:hover,
.mobile-nav li a.active {
  background: var(--bg-light);
  color: var(--primary);
  text-decoration: none;
}

/* --- Main Layout --- */
.page-wrapper {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  width: 100%;
}

/* Two-column layout */
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.main-content { min-width: 0; }
.sidebar { min-width: 0; }

/* --- Cards --- */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}
.card-header {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--bg-light);
}

/* --- Hero Section --- */
.hero {
  background: linear-gradient(135deg, #0e7490 0%, #0891b2 50%, #06b6d4 100%);
  color: white;
  padding: 2.5rem 1.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  text-align: center;
}
.hero h1 {
  color: white;
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}
.hero p {
  color: rgba(255,255,255,0.9);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}
.hero .updated-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 0.3rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  color: rgba(255,255,255,0.95);
}

/* --- Calculator Styles --- */
.calculator {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 2px solid var(--primary);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.calculator-header {
  background: var(--primary);
  color: white;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}
.calculator-body {
  padding: 1.5rem;
}
.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.form-group {
  display: flex;
  flex-direction: column;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.35rem;
}
.form-group label .unit {
  font-weight: 400;
  color: var(--text-light);
}
.form-group input,
.form-group select {
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-dark);
  background: var(--bg-white);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8,145,178,0.15);
}
.form-group input[type="number"] {
  -moz-appearance: textfield;
}
.form-group .help-text {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* Results */
.calc-results {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 2px dashed var(--border);
}
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.result-item {
  background: var(--bg-light);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  text-align: center;
}
.result-item.highlight {
  background: var(--primary);
  color: white;
  grid-column: 1 / -1;
}
.result-item.highlight .result-value { color: white; }
.result-item.highlight .result-label { color: rgba(255,255,255,0.85); }
.result-label {
  font-size: 0.78rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.result-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-top: 0.15rem;
}
.result-item.cost-highlight {
  background: var(--success-light);
  grid-column: 1 / -1;
}
.result-item.cost-highlight .result-value { color: #059669; }

/* Calculator sub-sections */
.calc-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.calc-section h3 {
  font-size: 1rem;
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

/* Area deductions */
.deduction-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
}
.deduction-row .form-group { margin-bottom: 0; }
.btn-remove {
  padding: 0.65rem 0.85rem;
  background: var(--error);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
.btn-remove:hover { background: #dc2626; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--bg-light); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.82rem; }

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.data-table thead th {
  background: var(--bg-light);
  padding: 0.65rem 0.85rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-dark);
  border-bottom: 2px solid var(--border);
  font-size: 0.82rem;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-mid);
}
.data-table tbody tr:hover { background: var(--bg-light); }

/* Responsive table wrapper */
.table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.table-wrapper .data-table { margin: 0; }

/* --- FAQ Section --- */
.faq-section { margin: 2rem 0; }
.faq-item {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  line-height: 1.4;
  transition: background 0.2s;
}
.faq-question:hover { background: var(--bg-light); }
.faq-arrow {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-light);
  transition: transform 0.3s;
  margin-left: 1rem;
}
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-answer {
  display: none;
  padding: 0 1.25rem 1rem;
  color: var(--text-mid);
  font-size: 0.92rem;
  line-height: 1.7;
}
.faq-item.open .faq-answer { display: block; }

/* --- Tip/Info boxes --- */
.tip-box {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0;
}
.tip-box strong { display: block; margin-bottom: 0.25rem; }
.info-box {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0;
}
.info-box strong { display: block; margin-bottom: 0.25rem; }

/* --- Ad Slots --- */
.ad-slot {
  background: var(--border-light);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 1.5rem 0;
  min-height: 90px;
  overflow: hidden;
}
.ad-slot-header { min-height: 90px; max-width: 728px; margin: 1rem auto; }
.ad-slot-content { min-height: 280px; }
.ad-slot-sidebar { min-height: 250px; }

/* --- Quick Links Grid --- */
.quick-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.quick-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.quick-link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-1px);
}
.quick-link-icon {
  width: 44px;
  height: 44px;
  background: var(--bg-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.quick-link-text h3 {
  font-size: 0.95rem;
  margin: 0;
  color: var(--text-dark);
}
.quick-link-text p {
  font-size: 0.82rem;
  margin: 0.15rem 0 0;
  color: var(--text-light);
}

/* --- Sidebar Widgets --- */
.sidebar-widget {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.sidebar-widget h3 {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--bg-light);
}
.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-nav li a {
  display: block;
  padding: 0.5rem 0.65rem;
  color: var(--text-mid);
  font-size: 0.88rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.2s;
}
.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background: var(--bg-light);
  color: var(--primary);
  text-decoration: none;
}
.sidebar-nav li a.active { font-weight: 600; }

/* --- Footer --- */
.site-footer {
  background: var(--text-dark);
  color: rgba(255,255,255,0.7);
  padding: 2.5rem 1rem 1.5rem;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.footer-col h4 {
  color: white;
  font-size: 0.9rem;
  margin-bottom: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.footer-col p { color: rgba(255,255,255,0.6); font-size: 0.85rem; }
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-col ul li a {
  display: block;
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
  padding: 0.25rem 0;
  text-decoration: none;
}
.footer-col ul li a:hover { color: white; text-decoration: none; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1rem;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  text-align: center;
}

/* --- Content Article --- */
.article-content {
  line-height: 1.8;
}
.article-content h2 {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}
.article-content h2:first-of-type {
  border-top: none;
  padding-top: 0;
}
.article-content h3 { margin-top: 1.75rem; }

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  padding: 0;
}
.breadcrumbs a { color: var(--primary); }
.breadcrumbs span { margin: 0 0.35rem; }

/* Updated badge inline */
.updated-inline {
  display: inline-block;
  background: var(--success-light);
  color: #059669;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* Print styles */
@media print {
  .site-header, .site-footer, .ad-slot, .sidebar, .mobile-nav, .menu-toggle { display: none !important; }
  .content-grid { grid-template-columns: 1fr !important; }
  .calculator { border: 1px solid #ccc; box-shadow: none; }
  body { background: white; }
}

/* --- Responsive: Tablet (640px+) --- */
@media (min-width: 640px) {
  h1 { font-size: 2.25rem; }
  .hero { padding: 3rem 2rem; }
  .hero h1 { font-size: 2rem; }
  .calc-grid { grid-template-columns: 1fr 1fr; }
  .results-grid { grid-template-columns: repeat(3, 1fr); }
  .result-item.highlight { grid-column: 1 / -1; }
  .result-item.cost-highlight { grid-column: 1 / -1; }
  .quick-links { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Responsive: Desktop (960px+) --- */
@media (min-width: 960px) {
  .menu-toggle { display: none; }
  .nav-links { display: flex; }
  .content-grid { grid-template-columns: 1fr 300px; }
  h1 { font-size: 2.5rem; }
  .hero h1 { font-size: 2.25rem; }
  .hero { padding: 3.5rem 2.5rem; }
  .page-wrapper { padding: 2rem 1.5rem 3rem; }
  .calculator-body { padding: 2rem; }
  .quick-links { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .results-grid { grid-template-columns: repeat(4, 1fr); }
}

/* --- Responsive: Large (1100px+) --- */
@media (min-width: 1100px) {
  .calc-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* --- Accessibility --- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  z-index: 200;
  font-weight: 600;
}
.skip-link:focus { top: 0; }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}
