:root {
    /* Ultra Simple Theme - Modern & Comfortable */
    --bg-color: #F8FAFC; 
    --bg-surface: #FFFFFF;
    --text-main: #0F172A; 
    --text-muted: #64748B; 
    --primary: #2563EB; 
    --primary-hover: #1d4ed8; 
    --border-color: #E2E8F0; 
    --success: #059669;
    --error: #DC2626;
    --badge-bg: #E2E8F0;
    --badge-text: #475569;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

html.dark {
    /* Simple Dark Theme */
    --bg-color: #0F172A; 
    --bg-surface: #1E293B;
    --text-main: #F8FAFC; 
    --text-muted: #94A3B8; 
    --primary: #3B82F6; 
    --primary-hover: #60A5FA; 
    --border-color: #334155; 
    --success: #34d399;
    --error: #F87171;
    --badge-bg: #334155;
    --badge-text: #94A3B8;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
header {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2.5rem;
    background-color: var(--bg-surface);
}

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

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.logo a {
    text-decoration: none;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

html.dark .logo a {
    background: linear-gradient(135deg, #60a5fa, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.4rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    background-color: var(--bg-color);
}

.back-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    background-color: var(--bg-surface);
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.4rem;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--bg-color);
}

/* Main Content */
main {
    flex: 1;
}

/* Homepage / Intro styling */
.intro-section {
    margin-bottom: 2rem;
}

.intro-section {
    margin-bottom: 3rem;
    text-align: center;
    padding: 1rem 0;
}

.intro-section h2 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.intro-text {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Tools List (flat directory format instead of large blocks) */
.tools-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 650px;
    margin: 0 auto 4rem auto;
}

.tool-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.25rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.tool-card:hover:not(.tool-card-disabled) {
    background: var(--bg-surface);
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

html.dark .tool-card:hover:not(.tool-card-disabled) {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tool-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.06);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

html.dark .tool-card-icon {
    background: rgba(59, 130, 246, 0.12);
}

.tool-card:hover:not(.tool-card-disabled) .tool-card-icon {
    background: var(--primary);
    color: white;
}

.tool-card-content {
    flex-grow: 1;
}

.tool-card-content h3 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 0.35rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tool-card-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.tool-card-action {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
}

.tool-card:hover:not(.tool-card-disabled) .tool-card-action {
    gap: 0.4rem;
}

.tool-card-disabled {
    opacity: 0.65;
    cursor: default;
}

.tool-card-disabled .tool-card-icon {
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-muted);
}

html.dark .tool-card-disabled .tool-card-icon {
    background: rgba(148, 163, 184, 0.08);
}

.tool-badge {
    font-size: 0.65rem;
    font-weight: 600;
    background-color: var(--badge-bg);
    color: var(--badge-text);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
}

/* Headings for single-tool pages */
h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
}

p {
    margin-bottom: 1rem;
}

.subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Current Epoch Text */
.current-epoch-section {
    margin-bottom: 1.75rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-surface);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.current-epoch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.live-label {
    font-size: 1rem;
    color: var(--text-muted);
}

.live-value-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.current-epoch-section strong {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    color: var(--primary);
    letter-spacing: 0.02em;
}

/* Copy Button styles */
.copy-btn-inline {
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.35rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background-color: var(--bg-color);
}

.copy-btn-inline:hover {
    color: var(--primary);
    border-color: var(--primary);
    background-color: var(--bg-surface);
}

/* Converter Forms */
.converter-section {
    margin-bottom: 1.75rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-surface);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

html.dark .converter-section,
html.dark .current-epoch-section {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="datetime-local"],
input[type="date"],
.select-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    border-radius: 6px;
    min-width: 250px;
    height: 38px; /* Consistent height */
    transition: all 0.15s ease-in-out;
}

input[type="text"] {
    font-family: var(--font-mono);
    flex: 1;
}

.select-input {
    min-width: 140px;
    cursor: pointer;
}

/* Date input specific style to allow flex expansion */
input[type="datetime-local"],
input[type="date"] {
    flex: 1.5;
}

/* Vertical input groups (used in Age Calculator) */
.input-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-width: 200px;
}

.input-group-vertical input {
    width: 100%;
    min-width: 0;
}

.input-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-align-bottom {
    align-self: flex-end;
}

input:focus,
.select-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn {
    padding: 0.5rem 1.25rem;
    border: 1px solid transparent;
    background-color: var(--primary);
    color: white;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 6px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:hover {
    background-color: var(--primary-hover);
}

.btn:focus {
    outline: none;
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

/* Result Blocks Layout (Vercel style) */
@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-block {
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    overflow: hidden;
    display: none;
}

.result-block.active {
    display: block;
    animation: fadeInSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.result-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-main);
    opacity: 0.8;
    padding: 0.6rem 1rem;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1.5rem;
    transition: background-color 0.15s ease;
}

.result-row:hover {
    background-color: rgba(37, 99, 235, 0.02);
}

html.dark .result-row:hover {
    background-color: rgba(59, 130, 246, 0.03);
}

.result-row:last-child {
    border-bottom: none;
}

.result-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    opacity: 0.75;
    min-width: 110px;
}

.result-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-main);
    word-break: break-all;
    flex-grow: 1;
}

.copy-btn-small {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.4rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.copy-btn-small:hover {
    color: var(--primary);
    background-color: var(--border-color);
}

/* Warnings */
.warning-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background-color: rgba(220, 38, 38, 0.04);
    border: 1px solid rgba(220, 38, 38, 0.12);
    color: var(--error);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 1rem;
    line-height: 1.45;
}

html.dark .warning-banner {
    background-color: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.18);
}

.warning-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.copy-svg {
    pointer-events: none;
}

.error-text {
    color: var(--error);
    padding: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Examples Table */
.time-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.time-table th,
.time-table td {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.time-table th {
    background-color: var(--bg-surface);
    font-weight: 600;
    color: var(--text-muted);
}

.text-right {
    text-align: right !important;
}

/* SEO Content */
.seo-content {
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Collapsible Sections */
.collapsible-section {
    margin-bottom: 1.25rem;
}

.collapsible-section summary {
    cursor: pointer;
    list-style: none; /* remove default arrow in firefox */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.collapsible-section summary::-webkit-details-marker {
    display: none; /* remove default arrow in webkit */
}

.collapsible-section summary::before {
    content: "▶";
    font-size: 0.75rem;
    color: var(--primary);
    transition: transform 0.2s ease;
}

.collapsible-section[open] summary::before {
    transform: rotate(90deg);
}

.collapsible-section summary h3 {
    margin-bottom: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    display: inline-block;
}

.collapsible-content {
    margin-top: 0.75rem;
    padding-left: 1.25rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.related-tools-list {
    list-style: none;
}

.related-tools-list li {
    margin-bottom: 0.5rem;
}

.related-tools-list a {
    color: var(--primary);
    text-decoration: none;
}

.related-tools-list a:hover {
    text-decoration: underline;
}

.coming-soon-link {
    opacity: 0.7;
    pointer-events: none;
    color: var(--text-muted) !important;
}

/* Footer */
footer {
    padding: 2rem 0;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
    background-color: var(--bg-surface);
}

/* Toast Notification (Snackbar) */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #0f172a;
    color: #f8fafc;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 999;
}

html.dark .toast {
    background: #f8fafc;
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

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

/* Textarea & Controls for Word Counter */
textarea {
    width: 100%;
    min-height: 200px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 1rem;
    border-radius: 8px;
    resize: vertical;
    line-height: 1.6;
    transition: all 0.15s ease-in-out;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.controls-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
    gap: 0.5rem;
}

.btn-sm {
    height: 32px;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

/* Responsive updates for small viewport forms */
@media (max-width: 580px) {
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    input[type="text"],
    input[type="datetime-local"],
    .select-input,
    .btn {
        width: 100%;
        min-width: 0;
    }
}
