:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #ede9fe;
    --secondary: #2563eb;
    --dark: #1e293b;
    --dark-gray: #475569;
    --gray: #64748b;
    --light-gray: #f8fafc;
    --white: #ffffff;
    --success: #10b981;
    --error: #ef4444;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

body {
    background: linear-gradient(135deg, #faf5ff 0%, #f0f9ff 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: var(--white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.hero {
    padding: 2rem 2rem 1rem;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--dark);
    line-height: 1.2;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.hero p {
    color: var(--dark-gray);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.converter-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    flex: 1;
    min-height: 0;
}

@media (max-width: 968px) {
    .converter-section {
        grid-template-columns: 1fr;
    }
}

.panel {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--white);
}

.panel-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.panel-title i {
    color: var(--primary);
    font-size: 1rem;
}

.panel-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.btn:hover {
    background-color: var(--light-gray);
    color: var(--dark);
}

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

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

.btn-outline {
    border: 1px solid var(--light-gray);
}

.token-count {
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 0.4rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.saved {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    padding: 0.4rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.panel-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.panel-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.editable-area {
    width: 100%;
    flex: 1;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius-sm);
    padding: 1.25rem;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    resize: none;
    transition: var(--transition);
    background-color: var(--light-gray);
    line-height: 1.5;
    min-height: 400px;
    color: var(--dark);
    white-space: pre;
    overflow: auto;
    outline: none;
    tab-size: 2;
}

.editable-area:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    background-color: var(--white);
}

.sync-status {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.sync-status i {
    color: var(--primary);
    font-size: 1.2rem;
}

.sync-status span {
    color: var(--dark-gray);
    font-size: 0.9rem;
    font-weight: 500;
}

.sync-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--success);
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

footer {
    background-color: var(--dark);
    color: var(--white);
    padding: 1.5rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.875rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.footer-link:hover {
    color: var(--white);
}

.copyright {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .hero {
        padding: 1.5rem 1rem 1rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .container {
        padding: 0 1rem 1.5rem;
    }
    
    .panel-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .panel-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .panel-controls-row {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .sync-status {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

.status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
}

.error-message {
    color: var(--error);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--border-radius-sm);
    display: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Add to existing CSS */
.editable-area:invalid {
    border-color: var(--error);
}

/* Focus styles for accessibility */
.btn:focus,
.editable-area:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* High contrast support */
@media (prefers-contrast: high) {
    :root {
        --primary: #000000;
        --secondary: #333333;
        --light-gray: #ffffff;
    }
}

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

    .sync-dot {
        animation: none;
    }
}

/* SEO Content Sections */
.features-section {
    padding: 3rem 0;
    background: var(--white);
    margin: 2rem 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.feature-card {
    text-align: center;
    padding: 2rem;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.feature-card h3 {
    color: var(--dark);
    margin-bottom: 1rem;
    font-family: 'Inter', sans-serif;
}

.feature-card p {
    color: var(--dark-gray);
    line-height: 1.6;
}

.faq-section {
    padding: 3rem 0;
    background: linear-gradient(135deg, #faf5ff 0%, #f0f9ff 100%);
    margin: 2rem 0;
    border-radius: var(--border-radius);
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--dark);
    font-family: 'Inter', sans-serif;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.faq-item {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.faq-item h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-family: 'Inter', sans-serif;
}

.faq-item p {
    color: var(--dark-gray);
    line-height: 1.6;
}

/* Screen reader only text */
.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;
}

/* Improved focus styles for accessibility */
.btn:focus,
.editable-area:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .panel-controls,
    .sync-status,
    footer {
        display: none;
    }

    .panel {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
