:root {
    --primary-color: #10b981;
    --primary-dark: #059669;
    --danger-color: #ef4444;
    --bg-color: #f3f4f6;
    --surface-color: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* SEO Header */
.seo-header {
    background: white;
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.seo-header h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.header-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Tool Container */
.tool-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    max-width: 1400px;
    width: 95%;
    margin: 20px auto;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 80vh;
    /* Fixed height for workspace feel */
}

/* Controls Header */
.top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: #f9fafb;
}

.mode-switcher {
    display: flex;
    gap: 10px;
    background: #e5e7eb;
    padding: 4px;
    border-radius: 8px;
}

.mode-btn {
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: white;
    color: var(--primary-dark);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ocr-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

/* Tool Views */
.tool-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Upload Screen */
.upload-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
}

.upload-card {
    background: white;
    padding: 48px;
    border-radius: 16px;
    border: 2px dashed #cbd5e1;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    max-width: 400px;
    width: 100%;
}

.upload-card:hover {
    border-color: var(--primary-color);
    background: #f0fdf9;
    transform: translateY(-4px);
}

.upload-icon {
    color: var(--primary-color);
    margin-bottom: 16px;
}

.btn-select {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 16px;
    cursor: pointer;
}

/* Progress Bar */
.progress-container {
    width: 240px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    margin: 16px auto;
    overflow: hidden;
}

#main-progress {
    height: 100%;
    width: 0%;
    background: var(--primary-color);
    transition: width 0.3s;
}

/* Editor Logic */
.editor-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.toolbar {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.arrow-selector {
    display: inline-flex;
    gap: 4px;
    margin-left: 4px;
}

.arrow-btn {
    padding: 6px 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.arrow-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}


.tool-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.tool-btn.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tool-btn.primary:hover {
    background: var(--primary-dark);
}

.tool-btn.danger {
    color: var(--danger-color);
}

.tool-btn.danger:hover {
    background: #fef2f2;
}

.file-badge {
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Split View */
.split-view-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.pdf-pane {
    width: 40%;
    min-width: 300px;
    background: #374151;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.pdf-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 8px;
    background: #1f2937;
    color: white;
    align-items: center;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
}

.canvas-wrapper {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    padding: 20px;
}

#pdf-canvas {
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    height: auto;
}


.grid-container {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: #f9fafb;
}

table {
    border-collapse: collapse;
    width: 100%;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

table,
th,
td {
    border: 1px solid #e5e7eb;
}

th {
    background: #f3f4f6;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    color: #374151;
}

td {
    padding: 8px;
    min-width: 80px;
}

td[contenteditable="true"]:focus {
    outline: 2px solid var(--primary-color);
    background: #f0fdf9;
}

/* Footer Features */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.feature-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.faq-section {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px 20px;
}

.help-guide {
    max-width: 800px;
    margin: 0 auto 60px;
    padding: 0 20px;
    background: #f0fdf9;
    border-radius: 12px;
    padding: 24px;
}

.help-guide h3 {
    margin-top: 0;
    color: var(--primary-dark);
}

.help-content ul {
    line-height: 1.8;
}

.help-content strong {
    color: var(--text-primary);
}


details {
    background: white;
    margin-bottom: 10px;
    padding: 16px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

summary {
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tool-container {
        height: auto;
        min-height: 80vh;
        width: 100%;
        margin: 0;
        border-radius: 0;
    }

    .top-controls {
        flex-direction: column;
        gap: 12px;
    }

    .toolbar {
        overflow-x: auto;
        padding-bottom: 12px;
    }

    .split-view-container {
        flex-direction: column;
    }

    .pdf-pane {
        width: 100%;
        height: 300px;
        flex-shrink: 0;
    }

    .btn-text {
        display: none;
    }
}

.hidden {
    display: none !important;
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: #1f2937;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    margin-top: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 180px;
    padding: 4px 0;
}

.context-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background 0.15s;
}

.context-item:hover {
    background: var(--bg-color);
}

.context-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}