:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* SEO Header */
.seo-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.seo-header h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin: 0 0 15px 0;
    font-weight: 700;
    line-height: 1.2;
}

.seo-header p {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    max-width: 900px;
    margin: 0 auto;
    opacity: 0.95;
    line-height: 1.7;
}

/* Tool Container */
.tool-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 15px;
}

/* Top Controls */
.top-controls {
    background: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
}

.mode-switcher {
    display: flex;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.mode-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

/* Tool View */
.tool-view {
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-height: 500px;
}

/* Upload Wrapper */
.upload-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    min-height: 500px;
}

.upload-card {
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: clamp(30px, 5vw, 60px);
    text-align: center;
    max-width: 500px;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.15);
}

.upload-icon {
    font-size: clamp(3rem, 8vw, 4rem);
    margin-bottom: 20px;
    color: var(--primary-color);
}

.upload-card h2 {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.upload-card p {
    color: var(--text-muted);
    margin-bottom: 25px;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.btn-select {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.9rem, 2vw, 1rem);
    min-height: 48px;
}

.btn-select:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Editor View */
.editor-view {
    padding: 20px;
}

.toolbar {
    background: #f8fafc;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.toolbar span {
    font-weight: 600;
    color: var(--text-primary);
    font-size: clamp(0.85rem, 2vw, 1rem);
}

.tool-btn {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    min-height: 44px;
}

.tool-btn:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

.tool-btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.tool-btn.primary:hover {
    background: var(--primary-dark);
}

/* Grid Container */
.grid-container {
    padding: 20px;
    overflow-y: auto;
    max-height: 700px;
}

/* Doc Preview */
.doc-preview {
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: clamp(30px, 5vw, 50px);
    min-height: 600px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    line-height: 1.8;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.hint {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 15px;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

/* Features Section */
.features-section {
    max-width: 1200px;
    margin: 60px auto;
    padding: 40px 20px;
    text-align: center;
}

.features-section h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 40px;
    color: var(--text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature-item {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.feature-item h3 {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    margin: 15px 0 10px 0;
    color: var(--text-primary);
}

.feature-item p {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

/* Instructions Section */
.instructions {
    max-width: 1200px;
    margin: 60px auto;
    padding: 40px 20px;
}

.instructions h2 {
    text-align: center;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 40px;
    color: var(--text-primary);
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.instruction-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.instruction-card h3 {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    margin-top: 0;
    color: var(--primary-color);
}

.instruction-card ol {
    padding-left: 20px;
    line-height: 1.9;
}

.instruction-card li {
    margin-bottom: 10px;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.instruction-card .note {
    background: #eff6ff;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid var(--primary-color);
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

/* FAQ Section */
.faq-section {
    max-width: 900px;
    margin: 60px auto;
    padding: 40px 20px;
}

.faq-section h2 {
    text-align: center;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 40px;
    color: var(--text-primary);
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

details {
    background: white;
    padding: 20px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

details:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

details[open] {
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.1);
}

summary {
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.1rem);
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

summary::-webkit-details-marker {
    display: none;
}

summary::before {
    content: '▶';
    color: var(--primary-color);
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

details[open] summary::before {
    transform: rotate(90deg);
}

details p {
    margin: 15px 0 0 0;
    color: var(--text-muted);
    line-height: 1.8;
    padding-left: 20px;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease;
    min-width: 200px;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

/* Responsive Design - Tablet */
@media (max-width: 768px) {
    .seo-header {
        padding: 30px 15px;
    }

    .tool-container {
        margin: 20px auto;
    }

    .top-controls {
        padding: 15px;
    }

    .mode-switcher {
        max-width: 100%;
    }

    .upload-wrapper {
        padding: 40px 15px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .instruction-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .toolbar {
        padding: 12px 15px;
        gap: 8px;
    }

    .grid-container {
        padding: 15px;
    }

    .doc-preview {
        padding: 25px;
    }

    .toast-container {
        right: 15px;
        bottom: 15px;
        left: 15px;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}

/* Responsive Design - Mobile */
@media (max-width: 480px) {
    .seo-header {
        padding: 25px 12px;
    }

    .seo-header h1 {
        font-size: 1.5rem;
    }

    .seo-header p {
        font-size: 0.9rem;
    }

    .tool-container {
        padding: 0 10px;
        margin: 15px auto;
    }

    .top-controls {
        padding: 12px;
        border-radius: 10px 10px 0 0;
    }

    .mode-switcher {
        padding: 4px;
    }

    .mode-btn {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .upload-wrapper {
        padding: 30px 10px;
        min-height: 400px;
    }

    .upload-card {
        padding: 25px 20px;
    }

    .upload-icon {
        font-size: 3rem;
    }

    .btn-select {
        padding: 12px 24px;
        width: 100%;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .tool-btn {
        width: 100%;
        justify-content: center;
    }

    .grid-container {
        padding: 10px;
        max-height: 500px;
    }

    .doc-preview {
        padding: 20px;
        min-height: 400px;
        font-size: 0.9rem;
    }

    .features-section,
    .instructions,
    .faq-section {
        margin: 40px auto;
        padding: 30px 15px;
    }

    .features-grid {
        gap: 15px;
    }

    .feature-item {
        padding: 25px 20px;
    }

    .instruction-card {
        padding: 25px 20px;
    }

    .instruction-card ol {
        padding-left: 15px;
    }

    details {
        padding: 15px;
    }

    summary {
        font-size: 1rem;
    }

    details p {
        font-size: 0.9rem;
    }
}

/* Extra Small Mobile */
@media (max-width: 360px) {
    .seo-header h1 {
        font-size: 1.3rem;
    }

    .upload-card {
        padding: 20px 15px;
    }

    .doc-preview {
        padding: 15px;
    }

    .feature-item,
    .instruction-card {
        padding: 20px 15px;
    }
}

/* Print Styles */
@media print {

    .seo-header,
    .top-controls,
    .toolbar,
    .features-section,
    .instructions,
    .faq-section,
    .toast-container {
        display: none !important;
    }

    .doc-preview {
        box-shadow: none;
        border: none;
        padding: 0;
    }
}

/* Format Toolbar */
.format-toolbar {
    background: #f8fafc;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    gap: 4px;
    align-items: center;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.format-btn {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 14px;
    min-width: 36px;
    height: 36px;
}

.format-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.format-btn:active,
.format-btn.active {
    background: var(--primary-dark);
    color: white;
}

.format-select {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    height: 36px;
}

.format-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.color-picker {
    width: 40px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    background: white;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 4px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Utility Buttons */
.utility-btn {
    background: #10b981;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 13px;
    height: 36px;
    white-space: nowrap;
}

.utility-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 400px;
    max-width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 10px;
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.modal-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.modal-btn:hover {
    background: #f1f5f9;
}

.modal-btn.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.modal-btn.primary:hover {
    background: var(--primary-dark);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* Loading Spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}