/* CSS Custom Properties for consistent theming */
:root {
    --primary-color: #2563eb;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --background: #ffffff;
    --surface: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-focus: #3b82f6;
    --success: #10b981;
    --code-bg: #1e293b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --font-sans: ui-sans-serif, system-ui, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: var(--font-sans);
    background: var(--surface);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 1rem;
    line-height: 1.7;
}

/* Page wrapper for desktop layout */
.page-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 1rem 0;
}

/* Main container */
.container {
    background: var(--background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    width: 100%;
    border: 1px solid var(--border);
    max-width: 48rem;
    margin: 0 auto;
}

/* Typography */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2rem 0 1rem 0;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem 0;
}

h4 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.25rem 0 0.5rem 0;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

ul, ol {
    color: var(--text-secondary);
    margin: 1rem 0;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

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

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.back-link:hover {
    text-decoration: underline;
}

.back-link::before {
    content: "←";
    margin-right: 0.5rem;
}

/* Utility text classes */
.last-updated {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

/* Content boxes */
.highlight-box,
.example-box {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 1.5rem 0;
}

.example-box h4,
.highlight-box h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.tip-box {
    background: #dbeafe;
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: var(--radius);
}

.tip-box strong {
    color: var(--primary-color);
}

.warning-box {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: var(--radius);
}

.warning-box strong {
    color: #f59e0b;
}

/* Code styling */
code {
    background: var(--code-bg);
    color: #e2e8f0;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.875em;
}

pre {
    background: var(--code-bg);
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1rem 0;
}

pre code {
    background: none;
    padding: 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.875rem;
}

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

th {
    background: var(--surface);
    font-weight: 600;
    color: var(--text-primary);
}

td {
    color: var(--text-secondary);
}

/* Cards */
.feature-grid,
.contact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature-card,
.contact-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.feature-card h3,
.contact-card h3 {
    margin-top: 0;
    color: var(--primary-color);
}

/* CTA Section */
.cta-section {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    margin: 2rem 0;
    border: 1px solid var(--border);
}

.cta-button {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: var(--radius);
    font-weight: 600;
    margin-top: 1rem;
    transition: var(--transition);
    text-decoration: none;
}

.cta-button:hover {
    background: var(--primary-light);
    text-decoration: none;
    transform: translateY(-1px);
}

/* FAQ Items */
.faq-section {
    margin-top: 2rem;
}

.faq-item {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.faq-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.faq-question {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.faq-answer {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.7;
}

.content-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 2rem;
    grid-column: 1 / -1;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -2.5rem;
    left: 0.375rem;
    background: var(--text-primary);
    color: var(--background);
    padding: 0.5rem;
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    z-index: 50;
}

.skip-link:focus {
    top: 0.375rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --border: #334155;
        --border-focus: #60a5fa;
    }

    .tip-box {
        background: #1e3a5f;
    }

    .warning-box {
        background: #3a2e1e;
    }
}

/* Responsive design */
@media (min-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.625rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .container {
        max-width: 52rem;
    }
}

@media (max-width: 767px) {
    body {
        padding: 0.5rem;
    }

    .container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .faq-item {
        padding: 1.25rem;
    }

    .feature-grid,
    .contact-cards {
        grid-template-columns: 1fr;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for better keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* ===== CONVERTER-SPECIFIC STYLES ===== */

/* Form elements */
.converter-section {
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1rem;
    position: relative;
}

.input-wrapper {
    position: relative;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

input[type="number"] {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--background);
    color: var(--text-primary);
    transition: var(--transition);
    appearance: textfield;
}

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

input[type="number"]:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

input[type="number"]:hover:not(:focus) {
    border-color: var(--text-muted);
}

.unit {
    position: absolute;
    right: 2.5rem;
    top: 55%;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    pointer-events: none;
}

/* Copy button */
.copy-btn {
    position: absolute;
    right: 0.375rem;
    top: 50%;
    width: 1.75rem;
    height: 1.75rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: var(--transition);
}

.copy-btn:hover {
    background: var(--surface);
    border-color: var(--text-muted);
    color: var(--text-secondary);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

/* Clear button */
.clear-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.clear-btn:active {
    transform: translateY(1px);
}

/* Highlight state */
.highlight {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 3px rgb(16 185 129 / 0.1) !important;
}

/* Reference section */
.conversion-info {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1.5rem;
    border: 1px solid var(--border);
}

.conversion-info h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
}

.conversion-info ul {
    list-style: none;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.conversion-info li {
    margin-bottom: 0.25rem;
    padding-left: 0.875rem;
    position: relative;
}

.conversion-info li:before {
    content: "•";
    color: var(--primary-color);
    font-weight: 600;
    position: absolute;
    left: 0;
}

/* SEO content - minimal styling */
.seo-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 2rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.seo-content h2,
.seo-content h3 {
    color: var(--text-primary);
}

.seo-content h2 {
    font-size: 1.5rem;
}

.seo-content h3 {
    font-size: 1.125rem;
}

.seo-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.25rem 0 0.5rem 0;
}

.seo-content p {
    margin-bottom: 1rem;
}

.seo-content ol,
.seo-content ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.seo-content li {
    margin-bottom: 0.5rem;
}

.seo-content strong {
    color: var(--primary-color);
    font-weight: 600;
}

.seo-content a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.seo-content a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* Side rail ads containers */
.ad-sidebar {
    display: none;
}

.ad-sidebar.left,
.ad-sidebar.right {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.ad-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ad-placeholder {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Desktop layout with side rails */
@media (min-width: 1024px) {
    .page-wrapper {
        grid-template-columns: 160px 1fr 160px;
        gap: 1.5rem;
        padding: 2rem 1rem;
    }

    .ad-sidebar {
        display: block;
    }

    .converter-page .container {
        max-width: 900px;
        margin: 0 auto;
    }
}

/* Extra large screens */
@media (min-width: 1280px) {
    .page-wrapper {
        grid-template-columns: 200px 1fr 200px;
        gap: 2rem;
    }

    .ad-container {
        min-height: 800px;
    }
}

/* Tablet layout */
@media (min-width: 768px) and (max-width: 1023px) {
    .converter-page .container {
        max-width: 700px;
        margin: 0 auto;
    }

    .seo-content {
        font-size: 0.9375rem;
        line-height: 1.7;
        padding: 2rem;
    }

    .seo-content h2 {
        font-size: 1.625rem;
    }

    .seo-content h3 {
        font-size: 1.25rem;
    }

    .seo-content h4 {
        font-size: 1.0625rem;
    }
}

/* Mobile optimization */
@media (max-width: 767px) {
    .converter-page .container {
        max-width: 100%;
        padding: 2rem;
    }
}

/* Converter page specific max-width */
.converter-page .container {
    max-width: 28rem;
}
