@import url('/static/fonts.css');

:root {
    --page-bg: #f4efe7;
    --ink: #203038;
    --muted: #6c757a;
    --accent: #8d4b34;
    --accent-soft: #fff6ef;
    --line: #e3d6c9;
    --panel: rgba(255, 253, 248, 0.96);
    --success: #2f7d4a;
    --warning: #9a6516;
}

body {
    font-family: var(--app-font-body);
    line-height: 1.6;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, #fff7ee 0, transparent 32%),
        linear-gradient(180deg, #efe6d9 0%, var(--page-bg) 100%);
}

h1, h2 {
    color: var(--ink);
    text-align: center;
}

.page-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 22px;
}

.topbar-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.reference-link {
    text-decoration: none;
    color: var(--accent);
    border: 1px solid var(--line);
    background: var(--accent-soft);
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 14px;
}

.reference-link.compact-link {
    display: inline-flex;
    padding: 7px 10px;
    font-size: 12px;
}

.locale-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.locale-toolbar label {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.hero-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 26px;
    padding: 26px 26px 18px;
    box-shadow: 0 14px 34px rgba(74, 44, 29, 0.06);
    margin-bottom: 22px;
}

.converter-eyebrow {
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

#page-title {
    margin: 0 0 10px;
    text-align: left;
    font-size: clamp(34px, 6vw, 60px);
    line-height: 0.95;
}

.page-subhead {
    margin: 0;
    max-width: 820px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.45;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 26px;
    margin-top: 22px;
}

.hero-action {
    text-decoration: none;
    color: var(--accent);
    border: 0;
    border-bottom: 2px solid currentColor;
    background: transparent;
    border-radius: 0;
    padding: 0 0 3px;
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 650;
    line-height: 1.15;
}

.hero-action.primary-action {
    background: transparent;
    color: var(--accent);
    border-color: currentColor;
}

.hero-action:hover,
.hero-action:focus-visible {
    color: var(--ink);
}

.hero-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.hero-stat-card {
    background: #fff9f2;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px 16px;
}

.stat-link-card {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(68, 42, 28, 0.1);
}

.hero-stat-value {
    font-size: 28px;
    line-height: 1;
    font-weight: 600;
}

.hero-stat-label {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}

.route-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.route-card,
.support-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 12px 28px rgba(68, 42, 28, 0.06);
}

.route-card {
    display: block;
    color: inherit;
    text-decoration: none;
    padding: 20px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.route-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(68, 42, 28, 0.1);
}

.route-card-tag {
    display: inline-block;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    background: #f9e5d9;
    border-radius: 999px;
    padding: 6px 10px;
    margin-bottom: 12px;
}

.route-card-title {
    margin: 0 0 10px;
    text-align: left;
    font-size: 28px;
    line-height: 1.05;
}

.route-card-copy {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 16px;
}

.route-card-link {
    color: var(--accent);
    font-size: 15px;
}

.support-panel {
    padding: 20px;
    margin-bottom: 22px;
}

.account-shell {
    max-width: 880px;
}

.account-hero h1 {
    text-align: left;
}

.account-panel {
    border-radius: 18px;
}

.account-status p,
.account-result p {
    margin: 4px 0;
    color: var(--muted);
}

.account-form {
    display: grid;
    gap: 10px;
    max-width: 520px;
}

.account-form label {
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
}

.account-form input,
.account-form select,
.account-form textarea {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 11px;
    font: inherit;
    background: #fffdf8;
    color: var(--ink);
}

.account-form button,
#account-logout,
.soft-account-button {
    width: fit-content;
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: 10px 14px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.account-form button:disabled,
.soft-account-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.soft-account-button {
    background: #fff6ee;
    color: var(--accent);
    border-color: var(--line);
}

.account-form-wide {
    max-width: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-form-wide label,
.account-form-wide input,
.account-form-wide select,
.account-form-wide textarea,
.account-form-wide button,
.account-form-actions {
    grid-column: span 1;
}

.account-form-wide textarea {
    min-height: 112px;
    resize: vertical;
}

.account-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.account-inline-date-helper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.account-inline-date-helper input {
    flex: 1 1 180px;
}

.account-editor {
    margin-top: 18px;
}

.account-result {
    margin-top: 14px;
}

.account-divider {
    height: 1px;
    background: var(--line);
    margin: 22px 0;
}

.account-user-line {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 14px;
}

.account-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--line);
}

.oauth-provider-list {
    display: grid;
    gap: 10px;
    max-width: 520px;
}

.oauth-provider-button {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffdf8;
    color: var(--ink);
    padding: 10px 12px;
    text-decoration: none;
    font: inherit;
}

.oauth-provider-button span {
    color: var(--muted);
    font-size: 13px;
}

.oauth-provider-button[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

.saved-views-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.saved-view-row {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffdf8;
    padding: 12px;
}

.saved-view-row h3 {
    margin: 0 0 4px;
    text-align: left;
    font-size: 18px;
}

.saved-view-row p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.saved-view-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.saved-view-actions button,
.saved-view-actions a {
    width: auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff6ee;
    color: var(--accent);
    padding: 7px 10px;
    font: inherit;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}

.account-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.account-filter-row select {
    width: auto;
    min-width: 180px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 10px;
    background: #fffdf8;
    color: var(--ink);
    font: inherit;
}

@media (max-width: 720px) {
    .account-form-wide {
        grid-template-columns: 1fr;
    }
}

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

.support-item h2 {
    text-align: left;
    font-size: 22px;
    margin: 0 0 8px;
}

.route-support-link {
    text-decoration: none;
    color: inherit;
    display: block;
    border-radius: 18px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.route-support-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(68, 42, 28, 0.08);
}

.today-home-panel h2 {
    margin: 0 0 14px;
    text-align: left;
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.05;
}

.today-home-widget-wrap {
    min-width: 0;
}

.today-home-widget-wrap .widget-container {
    display: flex;
    flex-direction: column;
    border-top: none;
    padding-top: 0;
    justify-content: flex-start;
    gap: 8px;
}

.today-home-widget-wrap .widget {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fffdf8;
    box-shadow: none;
}

.today-home-widget-wrap .widget:hover {
    transform: none;
    box-shadow: none;
    background: #fffaf4;
}

.today-home-main {
    width: 100%;
    max-width: none;
    background: #fffaf4;
    border: 1px solid var(--line);
    box-shadow: none;
}

.today-home-main .primary-line {
    font-size: clamp(18px, 2.5vw, 28px);
    line-height: 1.15;
}

.converter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.day-page-layout {
    align-items: flex-start;
}


.input-section { /* Keep existing input styles */
    background-color: var(--panel);
    padding: 20px;
    border-radius: 22px;
    box-shadow: 0 12px 28px rgba(68, 42, 28, 0.06);
    border: 1px solid var(--line);
    flex: 1;
    min-width: 300px;
    max-width: 450px; /* Adjust max-width if needed */
    margin-bottom: 20px; /* Add some margin */
}

.output-section { /* Keep existing output styles */
    background-color: var(--panel);
    padding: 20px;
    border-radius: 22px;
    box-shadow: 0 12px 28px rgba(68, 42, 28, 0.06);
    border: 1px solid var(--line);
    flex: 1;
    width: 100%; /* Make output take full width below input */
    min-width: 300px;
}

.day-output-section {
    min-width: 360px;
}

.output-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="number"],
input[type="text"],
select {
    width: calc(100% - 22px); /* Adjust for padding/border */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-sizing: border-box; /* Include padding and border in element's total width and height */
    background: #fff9f3;
    color: var(--ink);
}

button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1em;
}

button:hover {
    background-color: #7a3f2c;
}

.secondary-button {
    width: auto;
    min-width: 96px;
    background: #fff4ea;
    color: var(--accent);
    border: 1px solid var(--line);
}

.secondary-button:hover {
    background: #f7e4d5;
}

#results {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}




.error-message {
    color: #d9534f;
    margin-top: 10px;
    font-weight: bold;
}

.panel-block {
    margin-bottom: 18px;
}

.panel-block.locality-needed {
    border: 1px solid rgba(116, 71, 38, 0.32);
    border-radius: 8px;
    padding: 14px;
    background: #fffaf4;
}

.tinted-block {
    padding: 14px;
    border-radius: 16px;
    background: #fff6ef;
    border: 1px solid var(--line);
}

.section-kicker {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 8px;
}

.support-copy {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.schema-field-grid,
.two-col-grid,
.three-col-grid,
.five-col-grid {
    display: grid;
    gap: 14px;
}

.two-col-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.three-col-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.five-col-grid {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.inline-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-toolbar select {
    margin-bottom: 0;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.chip-button {
    width: auto;
    background: #fff9f3;
    color: var(--ink);
    border: 1px solid var(--line);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 14px;
}

.chip-button:hover {
    background: #f5eadf;
}

.comparison-chip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    background: #fff9f3;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 8px;
}

.comparison-chip-label {
    font-size: 14px;
    font-weight: 700;
}

.comparison-profile-select {
    width: auto;
    max-width: 190px;
    min-width: 140px;
    margin-bottom: 0;
    padding: 6px 8px;
}

.comparison-remove {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
}

.empty-inline-note,
.empty-state {
    color: var(--muted);
    font-size: 14px;
}

.hero-result-card {
    margin-top: 14px;
    background: linear-gradient(135deg, #fffaf4 0%, #fff3e8 100%);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 18px 20px;
    box-shadow: 0 12px 28px rgba(68, 42, 28, 0.05);
}

.day-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.hero-card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.hero-primary-line {
    font-size: clamp(24px, 3vw, 36px);
    line-height: 1.15;
    font-weight: 600;
    color: #111;
    margin-bottom: 8px;
}

.hero-secondary-line {
    color: var(--muted);
    font-size: 14px;
}

.mini-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mini-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--accent);
    font-size: 12px;
}

.note-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-item {
    padding: 12px 14px;
    border-radius: 14px;
    background: #fff9f3;
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: 14px;
}

.note-item strong {
    color: var(--accent);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.detail-card {
    padding: 12px 14px;
    border-radius: 14px;
    background: #fff9f3;
    border: 1px solid var(--line);
}

.detail-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 6px;
}

.detail-value {
    color: var(--ink);
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.confidence-chip {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid var(--line);
    background: #fff;
}

.confidence-chip.confidence-ok {
    color: var(--success);
}

.confidence-chip.confidence-warn {
    color: var(--warning);
}

.confidence-chip.confidence-subtle {
    color: var(--muted);
}

#loading {
    text-align: center;
    font-style: italic;
    color: #777;
}

/* Widget Container Styles */
.widget-container {
    display: flex; /* Use flexbox */
    flex-wrap: wrap; /* Allow items to wrap */
    gap: 1rem; /* Space between widgets */
    justify-content: center; /* Center widgets when wrapping */
    padding-top: 10px;
    border-top: 1px solid #eee;
  }

  /* Widget Styles (Your provided styles) */
  .widget {
    width: 280px; /* Slightly smaller width for better wrapping */
    border-radius: 12px; /* Slightly softer edges */
    padding: 1rem 1.2rem;
    /* margin: 1rem 0; */ /* Removed margin, handled by gap */
    color: #222;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07); /* Softer shadow */
    display: flex;
    flex-direction: column;
    gap: 0.4rem; /* Smaller gap */
    position: relative;
    transition: transform 0.2s ease-in-out; /* Add subtle hover effect */
  }
  .widget-link {
    color: inherit;
    text-decoration: none;
  }
  .widget-link:focus-visible {
    outline: 3px solid rgba(31, 111, 120, 0.36);
    outline-offset: 3px;
  }
  .widget:hover {
      transform: translateY(-2px); /* Lift effect on hover */
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .widget::after {
    content: attr(data-lang);
    position: absolute;
    bottom: 6px; /* Adjust position */
    right: 12px;
    font-size: 0.7rem;
    color: #aaa;
    font-style: italic;
    font-weight: 500;
  }

  .widget-header {
    font-weight: 600;
    font-size: 0.9rem; /* Smaller header */
    color: #666; /* Lighter header color */
    border-bottom: 1px solid #eee; /* Separator */
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
  }

  .primary-line {
    font-size: 1.3rem; /* Adjust size */
    font-weight: 600;
    color: #000;
    line-height: 1.3; /* Adjust line height */
  }

  .secondary-line {
    font-size: 0.85rem; /* Adjust size */
    color: #555;
    font-family: monospace; /* Good for fixed-width data like time */
  }

  .confidence-line {
    margin-top: 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }

  .confidence-ok {
    color: var(--success);
  }

  .confidence-warn {
    color: var(--warning);
  }

  .confidence-subtle {
    color: #6f777b;
  }

  .note-line {
    margin-top: 0.15rem;
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .note-warn {
    color: #7a5324;
  }

  .format-toolbar {
    margin-top: 4px;
  }

  .widget[data-lang]::after {
    content: attr(data-lang);
  }

  @media (min-width: 900px) {
    .converter-container {
      flex-wrap: nowrap;
      align-items: flex-start;
    }

    .output-section {
      min-height: 520px;
    }
  }

  @media (max-width: 680px) {
    .hero-panel {
      padding: 22px 18px 18px;
    }
  }

  /* Widget theme colors (Your provided styles) */
  .gregorian { border-left: 6px solid #4285F4; background: #eaf1fd; } /* Added Gregorian */
  .julian    { border-left: 6px solid #e0965c; background: #fcf7f2; }
  .hebrew    { border-left: 6px solid #7992d5; background: #f3f6fc; }
  .islamic   { border-left: 6px solid #008080; background: #e0f2f1; } /* Added Islamic */
  .persian   { border-left: 6px solid #c47f9b; background: #f9f2f5; } /* Added Persian */
  .indian    { border-left: 6px solid #FF9933; background: #fff5e6; } /* Added Indian */
  .coptic    { border-left: 6px solid #DAA520; background: #fff8e1; } /* Added Coptic */
  .byzantine { border-left: 6px solid #8A2BE2; background: #f4e6ff; } /* Added Byzantine */
  .nepali    { border-left: 6px solid #a4c98f; background: #f6faf4; }
  .chinese_lunar { border-left: 6px solid #DC143C; background: #fce4e8; } /* Added Chinese */
  .darian    { border-left: 6px solid #bc9fcb; background: #f9f5fb; }
  .french_republican { border-left: 6px solid #00008B; background: #e6e6fa; } /* Added French */
  .runic     { border-left: 6px solid #A0522D; background: #f5ebe0; } /* Added Runic */
  .jdn_calendar { border-left: 6px solid #708090; background: #f0f4f8; } /* Added JDN */
  .mjd       { border-left: 6px solid #778899; background: #f1f5f9; } /* Added MJD */
  .unix      { border-left: 6px solid #888;    background: #f5f5f5; }
  .excel_1900, .excel_1904 { border-left: 6px solid #66bb6a; background: #f2fbf3; }
  /* Add more specific classes and colors as needed */
  .default   { border-left: 6px solid #ccc; background: #f8f8f8; } /* Fallback style */

  /* Error styling within widget */
  .widget .error {
      color: #d9534f;
      font-weight: bold;
      font-size: 0.9rem;
  }
