/* ============================================
   TipCalc.info - Custom Styles
   iOS-inspired, mobile-first, high contrast
   Built on top of Pico CSS
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --tip-green: #1a8a4a;
  --tip-green-dark: #14703c;
  --tip-green-light: #e8f5e9;
  --tip-green-bg: #f0faf3;
  --tip-red: #d32f2f;
  --tip-yellow: #f9a825;
  --tip-orange: #ef6c00;
  --tip-blue: #007aff;
  --slider-thumb-size: 44px;

  --pico-primary: #1a8a4a;
  --card-radius: 16px;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  --card-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  --section-gap: 0.75rem;
  --label-color: var(--tip-green-dark);
}

[data-theme="dark"] {
  --tip-green-light: rgba(26, 138, 74, 0.15);
  --tip-green-bg: rgba(26, 138, 74, 0.08);
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --card-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  --label-color: #F0F1F3;
}

/* Pico dark mode auto-detect overrides */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tip-green-light: rgba(26, 138, 74, 0.15);
    --tip-green-bg: rgba(26, 138, 74, 0.08);
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
    --card-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    --label-color: #F0F1F3;
  }
}

/* --- Skip Link (accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 0.5rem 1rem;
  background: var(--tip-green);
  color: white;
  z-index: 9999;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* --- Global --- */
body {
  -webkit-text-size-adjust: 100%;
}

.site-brand {
  text-decoration: none;
  color: var(--tip-green);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-logo {
  width: 28px;
  height: 28px;
  border-radius: 4px;
}

/* Remove underlines from all links globally */
a {
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

/* --- Language dropdown uses position:fixed (set by JS) to escape stacking contexts --- */

/* --- Language Selector (Flag-based) --- */
.lang-selector-wrapper {
  position: relative;
}

.lang-button {
  background: transparent;
  border: none;
  padding: 0.35rem 0.6rem;
  margin: 0;
  cursor: pointer;
  line-height: 1;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.lang-button:hover {
  background-color: var(--tip-green-light);
}

.lang-button .current-flag {
  display: inline-block;
  width: 1.75em;
  height: 1.3em;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.lang-menu {
  position: fixed;
  background: var(--pico-card-background-color, var(--pico-background-color, #1a1a2e));
  border: 1px solid var(--muted-border-color);
  border-radius: 12px;
  box-shadow: var(--card-shadow-lg);
  min-width: 200px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 99999;
  padding: 0.5rem;
}

.lang-menu[hidden] {
  display: none;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
  transition: background-color 0.15s ease;
}

.lang-option:hover {
  background-color: var(--tip-green-light);
}

.lang-option.active {
  background-color: var(--tip-green-light);
  font-weight: 600;
}

.lang-option .fi {
  width: 1.5em;
  height: 1.125em;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.lang-option .lang-name {
  flex: 1;
}

/* --- Featured Guide Banner --- */
.featured-banner {
  max-width: 480px;
  margin: 0 auto 1rem;
  padding: 0.6rem 1rem;
  background: var(--tip-green-light);
  border: 2px solid var(--tip-green);
  border-radius: var(--card-radius);
  box-shadow: 0 4px 12px rgba(26, 138, 74, 0.25);
  text-align: center;
}

.featured-banner-question {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.3;
}

@media (prefers-color-scheme: dark) {
  .featured-banner-question {
    color: rgba(255, 255, 255, 0.92);
  }
}

[data-theme="dark"] .featured-banner-question {
  color: rgba(255, 255, 255, 0.92);
}

.featured-banner-answer {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
}

.featured-banner-link {
  display: inline-block;
  font-weight: 700;
  color: var(--tip-green);
  font-size: 0.85rem;
  padding: 0;
  transition: color 0.15s ease;
}

.featured-banner-link:hover {
  color: var(--tip-green-dark);
}

/* ============================================
   CALCULATOR - iOS-inspired card design
   ============================================ */

.calculator,
.content-section {
  max-width: 480px;
  margin: 0 auto;
}

.site-heading {
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 0.25rem;
  font-weight: 700;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.tagline {
  text-align: center;
  opacity: 0.7;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Card Sections --- */
.input-group,
.quality-section,
.gratuity-section,
.split-section {
  margin-bottom: var(--section-gap);
  background: var(--pico-card-background-color);
  border-radius: var(--card-radius);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--pico-muted-border-color);
}

.input-group label,
.split-section > label,
.quality-section > label,
.gratuity-section > label {
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: block;
  font-size: 1.1rem;
  color: var(--label-color);
}

.input-group input[type="number"] {
  font-size: 1.25rem;
  padding: 0.75rem;
  min-height: 48px;
  border-radius: 12px;
  -moz-appearance: textfield;
}

.input-group input[type="number"]::-webkit-inner-spin-button,
.input-group input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* --- Service Quality Slider Section --- */
.quality-section > label {
  margin-bottom: 0.5rem;
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--label-color);
}

.quality-display {
  text-align: center;
  margin-bottom: 0.25rem;
}

.quality-score {
  display: block;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 0.75rem;
  opacity: 0.7;
}

.quality-emoji {
  font-size: 4rem;
  display: block;
  line-height: 1;
  margin-bottom: 0.5rem;
  transition: transform 0.2s ease;
  user-select: none;
}

.quality-label {
  font-size: 1.1rem;
  font-weight: 700;
  display: block;
  margin-top: 0.25rem;
  transition: color 0.2s ease;
}

.quality-label[data-level="terrible"] { color: var(--tip-red); }
.quality-label[data-level="poor"] { color: var(--tip-orange); }
.quality-label[data-level="below-average"] { color: var(--tip-orange); }
.quality-label[data-level="average"] { color: var(--tip-yellow); }
.quality-label[data-level="good"] { color: var(--tip-green); }
.quality-label[data-level="great"] { color: var(--tip-green); }
.quality-label[data-level="exceptional"] { color: var(--tip-green); }

[data-theme="dark"] .quality-label[data-level="terrible"] { color: #ef5350; }
[data-theme="dark"] .quality-label[data-level="good"],
[data-theme="dark"] .quality-label[data-level="great"],
[data-theme="dark"] .quality-label[data-level="exceptional"] { color: #66bb6a; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .quality-label[data-level="terrible"] { color: #ef5350; }
  :root:not([data-theme="light"]) .quality-label[data-level="good"],
  :root:not([data-theme="light"]) .quality-label[data-level="great"],
  :root:not([data-theme="light"]) .quality-label[data-level="exceptional"] { color: #66bb6a; }
}

/* Range slider - large thumb for mobile, color gradient */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  outline: none;
  margin: 1rem 0 0.5rem;
  background: linear-gradient(to right,
    var(--tip-red) 0%,
    var(--tip-orange) 25%,
    var(--tip-yellow) 50%,
    var(--tip-green) 100%
  );
  border: none;
  touch-action: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: var(--slider-thumb-size);
  border-radius: 8px;
  background: white;
  border: 3px solid var(--tip-green);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.15s ease;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: var(--slider-thumb-size);
  border-radius: 8px;
  background: white;
  border: 3px solid var(--tip-green);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

input[type="range"]:active::-webkit-slider-thumb {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  transform: scale(1.1);
}

input[type="range"]:focus::-webkit-slider-thumb {
  border-color: var(--tip-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

input[type="range"]:focus::-moz-range-thumb {
  border-color: var(--tip-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  opacity: 0.6;
}

/* --- Gratuity Toggle --- */
.gratuity-section {
  margin-bottom: var(--section-gap);
}

.gratuity-section > label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--label-color);
}

.gratuity-status {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--tip-green);
  margin-left: auto;
}

.gratuity-status.active {
  color: var(--tip-red);
}

/* Hide Pico's default switch styling, use our own */
.gratuity-section input[type="checkbox"][role="switch"] {
  width: 52px;
  height: 32px;
  min-height: auto;
  margin: 0;
  border-radius: 16px;
  flex-shrink: 0;
}

.gratuity-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  padding: 0 1rem;
  background: var(--pico-card-background-color);
  border-radius: var(--card-radius);
  border: 2px solid var(--tip-yellow);
  box-shadow: var(--card-shadow);
  transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease, padding 0.3s ease;
}

.gratuity-details.visible {
  max-height: 300px;
  opacity: 1;
  margin-top: 0.75rem;
  padding: 1rem;
}

.gratuity-alert {
  color: var(--tip-orange);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.gratuity-inputs {
  display: flex;
  gap: 0.75rem;
  align-items: end;
}

.gratuity-inputs .input-group {
  flex: 1;
  margin-bottom: 0;
}

.gratuity-inputs .input-group input[type="number"] {
  font-size: 1.1rem;
  border-radius: 10px;
}

/* --- Split / Number of People --- */
.split-section {
  margin-bottom: var(--section-gap);
  text-align: left;
}

.people-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.people-control button {
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tip-green);
  color: white;
  border: none;
  box-shadow: 0 2px 6px rgba(26, 138, 74, 0.3);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.people-control button:active {
  transform: scale(0.95);
  box-shadow: 0 1px 3px rgba(26, 138, 74, 0.3);
}

.people-control .people-count {
  font-size: 1.75rem;
  font-weight: 800;
  min-width: 2rem;
  text-align: center;
}

/* ============================================
   RESULTS - High contrast, clear hierarchy
   ============================================ */

.results {
  background: var(--tip-green);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  margin-top: 0.75rem;
  text-align: center;
  color: white;
  box-shadow: var(--card-shadow-lg);
  min-height: 160px;
}

.result-main {
  margin-bottom: 1.25rem;
}

.result-main .label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.result-main .amount {
  font-size: clamp(2rem, 10vw, 4rem);
  font-weight: 800;
  color: white;
  line-height: 1.1;
  display: block;
  margin: 0.15rem 0;
}

.result-main .tip-percent {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

/* Receipt breakdown — always visible */
.receipt {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  text-align: left;
}

.receipt-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.25rem 0;
}

.receipt-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.receipt-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  font-variant-numeric: tabular-nums;
}

.receipt-divider {
  border: none;
  border-top: 1px dashed rgba(255, 255, 255, 0.4);
  margin: 0.4rem 0;
}

.receipt-total .receipt-label {
  font-size: 0.9rem;
  color: white;
  font-weight: 700;
}

.receipt-total .receipt-value {
  font-size: 1.35rem;
  font-weight: 800;
}

.receipt-per-person {
  margin-top: 0.2rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.receipt-per-person .receipt-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.receipt-per-person .receipt-value {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
}

.per-person-note {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.gratuity-note {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  font-size: 0.85rem;
  color: white;
  font-weight: 600;
}

/* ============================================
   CONTENT PAGES - Better typography & cards
   ============================================ */

/* --- Calculator CTA in guides --- */
.calculator-cta {
  background: var(--tip-green-bg);
  border-radius: var(--card-radius);
  padding: 1.25rem;
  margin: 2rem 0;
  border-left: 4px solid var(--tip-green);
  box-shadow: var(--card-shadow);
}

/* --- Guide cards / listings --- */
.guides-list {
  list-style: none;
  padding: 0;
}

.guides-list li {
  margin-bottom: 0.75rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--pico-card-background-color);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--pico-muted-border-color);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.guides-list li:hover {
  box-shadow: var(--card-shadow-lg);
  transform: translateY(-1px);
}

.guides-list a {
  font-weight: 600;
  font-size: 1.05rem;
}

.guides-list p {
  margin: 0.25rem 0 0;
  opacity: 0.7;
  font-size: 0.9rem;
}

/* --- Ad Slots --- */
.ad-slot {
  text-align: center;
  margin: 1rem 0;
}

.ad-slot--header { min-height: 0; }
.ad-slot--in-content { min-height: 0; margin: 2rem 0; }
.ad-slot--footer { min-height: 0; }

/* --- Footer --- */
.site-footer {
  text-align: center;
}

.site-footer nav,
.site-footer nav ul,
.footer-nav {
  display: flex;
  justify-content: center;
}

.footer-nav {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-nav li {
  padding: 0;
}

.footer-nav a {
  font-size: 0.85rem;
  color: var(--tip-green);
}

.footer-copy {
  font-size: 0.7rem;
  opacity: 0.6;
  margin: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 768px) {
  .calculator,
  .content-section {
    max-width: 520px;
  }

}

@media (min-width: 1024px) {
  .calculator,
  .content-section {
    max-width: 560px;
  }
}

/* ============================================
   SHARE BUTTONS
   ============================================ */

.share-buttons {
  margin: 1.5rem auto;
  padding: 1rem 1.25rem;
  background: var(--tip-green-bg);
  border-radius: var(--card-radius);
  max-width: 480px;
  text-align: center;
  border: 1px solid var(--pico-muted-border-color);
}

.share-label {
  margin: 0 0 0.75rem 0;
  font-weight: 600;
  font-size: 1rem;
  color: var(--label-color);
}

.share-button-group {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: white;
  text-decoration: none;
  border-radius: 50%;
  font-size: 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.share-button:hover {
  transform: translateY(-2px);
}

.share-button:focus {
  outline: 2px solid var(--tip-green);
  outline-offset: 2px;
}

/* Platform brand colors + colored shadows */
.share-facebook { background: #1877F2; box-shadow: 0 3px 8px rgba(24, 119, 242, 0.4); }
.share-twitter  { background: #000000; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35); }
.share-reddit   { background: #FF4500; box-shadow: 0 3px 8px rgba(255, 69, 0, 0.4); }
.share-whatsapp { background: #25D366; box-shadow: 0 3px 8px rgba(37, 211, 102, 0.4); }

.share-facebook:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(24, 119, 242, 0.5); }
.share-twitter:hover  { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }
.share-reddit:hover   { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(255, 69, 0, 0.5); }
.share-whatsapp:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5); }

/* ============================================
   BREADCRUMB
   ============================================ */

.breadcrumb {
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
}

.breadcrumb li:not(:last-child)::after {
  content: "›";
  margin-left: 0.5rem;
  opacity: 0.5;
}

.breadcrumb a {
  text-decoration: none;
  color: var(--tip-green);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb li[aria-current="page"] {
  opacity: 0.7;
}

/* ============================================
   RTL SUPPORT
   ============================================ */


[dir="rtl"] .calculator-cta {
  border-left: none;
  border-right: 4px solid var(--tip-green);
}

/* ============================================
   PRINT
   ============================================ */

@media print {
  .ad-slot,
  .lang-switcher,
  nav,
  footer {
    display: none !important;
  }

  .results {
    border: 2px solid #000;
    color: #000;
    background: #e8f5e9;
  }

  .results .amount,
  .results .value {
    color: #000;
  }
}
