/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* CSS Variables */
:root {
    /* Colors */
    --primary-color: #3a032d;
    --secondary-color: #ffc800;
    --background-color: #fbf9f0;
    --text-color: #3a032d;
    --text-muted: #666;
    --border-color: #e0e0e0;
    --white: #ffffff;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;

    /* Typography */
    --font-primary: 'JetBrains Mono', Helvetica, Arial, sans-serif;
    --font-heading: 'Space Grotesk', Helvetica, Arial, sans-serif;

    /* Spacing */
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border radius */
    --border-radius: 4px;
    --border-radius-lg: 8px;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 var(--spacing-md) 0;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h4 {
    font-size: 1.25rem;
    font-weight: 400;
}

h5 {
    font-size: 1.125rem;
    font-weight: 600;
}

h6 {
    font-size: 1rem;
    font-weight: 600;
}

p {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 1rem;
    line-height: 1.6;
}

.lead {
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.6;
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--secondary-color);
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    border-radius: 8px;
    z-index: 1000;
    border: 1px solid var(--secondary-color);
    font-weight: 500;
}

.skip-link:focus {
    top: 6px;
}

.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;
}

/* Breadcrumb Navigation */
.breadcrumb {
    background: var(--secondary-color);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    font-size: 14px;
    font-weight: 400;
}

.breadcrumb li {
    color: var(--text-color);
}

.breadcrumb li+li::before {
    content: '/';
    margin: 0 12px;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--text-color);
}

/* App Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    min-height: calc(100vh - 180px);
}

/* Header */
.header {
    text-align: center;
    padding: 40px 0 20px;
}

.header p {
    font-size: 1.25rem;
    font-weight: 400;
    margin: 0 auto;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    padding: 20px 24px;
    min-width: 0;
    overflow: hidden;
}


/* Section Styling */
.input-section,
.output-section {
    padding: 32px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.section-header {
    margin-bottom: 20px;
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-bottom: 20px;
}


/* Preview Section */
.preview-section {
    margin-top: 24px;
    padding: 20px 24px;
    min-width: 0;
    overflow: hidden;
}

.preview-wrapper {
    position: relative;
    height: 400px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--background-color);
    overflow: auto;
    padding: 20px;
}

#table-preview {
    width: 100%;
    height: 100%;
    overflow: auto;
}

#table-preview:empty::before {
    content: 'Table preview will appear here when you paste data...';
    color: var(--text-muted);
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    font-size: 14px;
}


/* Preview Table Styling */
#table-preview table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 0;
    background: var(--background-color);
    border-radius: 8px;
    overflow: hidden;
}

#table-preview th,
#table-preview td {
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    text-align: left;
    vertical-align: top;
    word-wrap: break-word;
    max-width: 200px;
}

#table-preview th {
    background: var(--success);
    font-weight: 600;
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 2px solid var(--border-color);
}

#table-preview td {
    color: var(--text-color);
    background: var(--background-color);
}

#table-preview tr:hover td {
    background: var(--border-color);
}

/* Input & Output Styling */
#input,
#output {
    width: 100%;
    height: 100%;
    padding: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 12px;
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: var(--background-color);
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    overflow: auto;
    white-space: pre;
    word-wrap: normal;
    word-break: normal;
    overflow-wrap: normal;
    min-width: 0;
    max-width: 100%;
    font-weight: 400;
}

#input {
    color: #1a1a1a;
}

#output {
    color: var(--text-color);
    margin: 0;
}

#input:focus,
#output:focus {
    border-color: var(--text-color);
    box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.1);
}

#input::placeholder {
    color: #9ca3af;
    font-style: normal;
    font-weight: 400;
}

#output::placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

/* Output Wrapper */
.output-wrapper {
    position: relative;
    height: 420px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}


/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background-color);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--text-muted);
    padding: 20px 24px;
    z-index: 1000;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-content {
    margin-top: 20px;
    text-align: center;
}

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

/* Content Section */
.desc-content {
    background: var(--background-color);
    padding: 60px 24px 240px;
    margin-top: 0;
    border-top: 1px solid var(--border-color);
}

.desc-content .container {
    max-width: 1200px;
    margin: 0 auto;
}

.desc-content h2 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: -0.02em;
}

.desc-content ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.desc-content li {
    background: var(--background-color);
    padding: 28px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 14px;
}

.desc-content li:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
}

.desc-content li strong {
    color: var(--text-color);
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 1.1rem;
}


/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.3;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    user-select: none;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(0.95);
}

.btn:active {
    transform: translateY(0);
}

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

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

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

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

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

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .input-section,
    .output-section {
        padding: 24px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .button-group {
        gap: 12px;
    }
}