:root {
    --primary: #e53e3e;
    --primary-hover: #c53030;
    --primary-light: #fff5f5;
    --secondary: #3182ce;
    --secondary-hover: #2b6cb0;
    --text-main: #2d3748;
    --text-muted: #718096;
    --bg-main: #f7fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 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);
    --radius: 12px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* --- Utility Classes --- */
.hidden {
    display: none !important;
}

/* --- Header Styles --- */
header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--text-main);
    cursor: pointer;
}

.logo-container svg {
    width: 28px;
    height: 28px;
    fill: var(--primary);
}

.logo-text span {
    color: var(--primary);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 24px;
    list-style: none;
}

.nav-item {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 220px;
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 6px;
    z-index: 101;
    margin-top: 5px;
}

.dropdown:hover .dropdown-menu {
    display: flex;
}

.dropdown-menu a {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.dropdown-menu a:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(229, 62, 62, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 2px;
}

/* --- Main Content Layout --- */
main {
    flex: 1;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
}

/* --- Hero Section --- */
.hero {
    text-align: center;
    margin-bottom: 50px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
    letter-spacing: -0.025em;
}

.hero h1 span {
    color: var(--primary);
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
}

/* --- Tools Grid Section --- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}

.tool-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary);
    opacity: 0;
    transition: var(--transition);
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(229, 62, 62, 0.15);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background-color: var(--primary-light);
    color: var(--primary);
    transition: var(--transition);
}

.tool-card:hover .tool-icon {
    background-color: var(--primary);
    color: #ffffff;
}

.tool-icon svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.tool-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.tool-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    flex-grow: 1;
}

/* --- Workspace Views (Dynamic Interface) --- */
.workspace {
    display: flex;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-md);
    flex-direction: column;
    gap: 30px;
    animation: fadeIn 0.3s ease;
}

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

.back-btn-container {
    display: flex;
    align-items: center;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    font-size: 0.95rem;
}

.back-btn:hover {
    color: var(--primary-hover);
    transform: translateX(-4px);
}

.back-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.tool-header-info {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.tool-header-info h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.tool-header-info p {
    color: var(--text-muted);
    font-size: 1rem;
}

.workspace-split-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.workspace-main {
    flex: 2;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.workspace-side {
    flex: 1;
    min-width: 280px;
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: fit-content;
}

.side-title {
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 5px;
    color: var(--text-main);
}

/* --- Drag and Drop File Zone --- */
.dropzone {
    border: 3px dashed var(--border);
    border-radius: var(--radius);
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    background-color: var(--bg-main);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.dropzone-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #ffffff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.dropzone:hover .dropzone-icon {
    transform: scale(1.1);
}

.dropzone-icon svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.dropzone-text h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.dropzone-text p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.file-input-hidden {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

/* --- Selected Files List --- */
.files-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.files-list-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.file-item {
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: fadeIn 0.2s ease;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.file-icon {
    color: var(--primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.file-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.file-details {
    min-width: 0;
}

.file-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.file-action-btn:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.file-action-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* --- Settings Panel Controls --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-main);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23718096'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 36px;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-slider {
    flex-grow: 1;
    accent-color: var(--primary);
    cursor: pointer;
}

.slider-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    width: 32px;
    text-align: right;
}

/* --- Loading State --- */
.loading-view {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    gap: 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-view h3 {
    font-size: 1.4rem;
    font-weight: 700;
}

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

/* --- Success / Download View --- */
.success-view {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #c6f6d5;
    color: #38a169;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px -3px rgba(56, 161, 105, 0.2);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.success-icon svg {
    width: 40px;
    height: 40px;
    fill: currentColor;
}

.success-view h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

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

.btn-download {
    font-size: 1.1rem;
    padding: 14px 40px;
    background-color: var(--primary);
    color: #ffffff;
    border-radius: var(--radius);
    box-shadow: 0 10px 20px -3px rgba(229, 62, 62, 0.3);
    margin-top: 10px;
    text-align: center;
    width: 100%;
    max-width: 320px;
}

.btn-download:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -3px rgba(229, 62, 62, 0.4);
}

.btn-download-icon {
    display: flex;
    align-items: center;
}

.btn-download-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.success-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.success-action-link {
    color: var(--secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.success-action-link:hover {
    color: var(--secondary-hover);
    text-decoration: underline;
}

.error-banner {
    display: none;
    background-color: #fff5f5;
    border: 1.5px solid #fed7d7;
    color: var(--primary-hover);
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.2s ease;
}

.error-banner svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

/* --- Footer Styles --- */
footer {
    background-color: #1a202c;
    color: #e2e8f0;
    border-top: 1px solid #2d3748;
    padding: 50px 20px 30px;
    margin-top: auto;
}

.footer-content {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.footer-brand {
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.3rem;
    color: #ffffff;
}

.footer-logo svg {
    width: 26px;
    height: 26px;
    fill: var(--primary);
}

.footer-logo span {
    color: var(--primary);
}

.footer-brand p {
    color: #a0aec0;
    font-size: 0.88rem;
}

.footer-links-grid {
    display: grid;
    grid-template-columns: repeat(3, 140px);
    gap: 40px;
}

.footer-links-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-col-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-links-col a {
    font-size: 0.85rem;
    color: #a0aec0;
    transition: var(--transition);
}

.footer-links-col a:hover {
    color: var(--primary);
}

.footer-bottom {
    max-width: 1300px;
    margin: 0 auto;
    border-top: 1px solid #2d3748;
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: #718096;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-bottom-links {
    display: flex;
    gap: 20px;
}

.footer-bottom-links a:hover {
    color: #e2e8f0;
}

/* --- Responsive Queries --- */
@media (max-width: 900px) {
    .hero h1 {
        font-size: 2.2rem;
    }
    .navbar {
        height: 60px;
    }
    .nav-menu {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background-color: var(--bg-card);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 20px;
        gap: 12px;
        box-shadow: var(--shadow-md);
    }
    .nav-menu.active {
        display: flex;
    }
    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        display: none;
        padding-left: 20px;
    }
    .dropdown:hover .dropdown-menu {
        display: none;
    }
    .dropdown.active .dropdown-menu {
        display: flex;
    }
    .menu-toggle {
        display: flex;
    }
    .footer-content {
        flex-direction: column;
    }
    .footer-links-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        width: 100%;
    }
}

@media (max-width: 600px) {
    main {
        padding: 20px 15px;
    }
    .hero {
        margin-bottom: 30px;
    }
    .hero h1 {
        font-size: 1.8rem;
    }
    .workspace {
        padding: 20px;
    }
    .dropzone {
        padding: 30px 10px;
    }
}

/* --- SEO Content Section Styles --- */
.seo-content-section {
    max-width: 1000px;
    margin: 60px auto 20px;
    padding: 40px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.4s ease;
}

.seo-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
    text-align: center;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 12px;
}

.seo-intro {
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 30px;
    text-align: center;
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.seo-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: var(--transition);
}

.seo-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: rgba(229, 62, 62, 0.15);
}

.seo-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.seo-card-title svg {
    width: 20px;
    height: 20px;
    fill: var(--primary);
}

.seo-card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.seo-steps-section {
    margin-bottom: 40px;
    background: linear-gradient(135deg, var(--bg-main) 0%, var(--primary-light) 100%);
    padding: 30px;
    border-radius: var(--radius);
    border: 1px dashed var(--primary);
}

.seo-steps-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.seo-steps-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.seo-step-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.seo-step-num {
    background-color: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.seo-step-text h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.seo-step-text p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.seo-faq-section {
    margin-bottom: 20px;
}

.seo-faq-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.seo-faq-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.seo-faq-item {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.seo-faq-question {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.seo-faq-answer {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.5;
}

@media (max-width: 600px) {
    .seo-content-section {
        margin-top: 30px;
        padding: 20px 15px;
    }
    .seo-title {
        font-size: 1.5rem;
    }
}

/* --- Page Thumbnails Grid (Interactive Visual Editor) --- */
.pages-preview-box {
    margin-top: 20px;
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    width: 100%;
}

.pages-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 24px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.page-thumbnail-card {
    background-color: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: grab;
    transition: var(--transition);
    user-select: none;
    box-shadow: var(--shadow-sm);
}

.page-thumbnail-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.page-thumbnail-card:active {
    cursor: grabbing;
}

.page-thumbnail-card.dragging {
    opacity: 0.4;
    border-style: dashed;
    border-color: var(--primary);
}

.page-thumbnail-card canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background-color: white;
    margin-bottom: 8px;
    transition: transform 0.2s ease;
}

.page-thumbnail-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
}

.thumbnail-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    gap: 4px;
    z-index: 5;
}

.page-thumbnail-card:hover .thumbnail-actions {
    display: flex;
}

.page-thumbnail-card.selected {
    border-color: var(--primary) !important;
    background-color: var(--primary-light) !important;
    box-shadow: 0 0 0 2px var(--primary) !important;
}

.checkmark-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: var(--primary);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    z-index: 2;
}

.page-thumbnail-card.selected .checkmark-overlay {
    display: flex;
}

.checkmark-overlay svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
    display: block;
}


.action-btn-small {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.action-btn-small:hover {
    color: white;
    border-color: var(--primary);
    background-color: var(--primary);
}

.action-btn-small.delete:hover {
    background-color: #e53e3e;
    border-color: #e53e3e;
}

.action-btn-small svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

/* Page Thumbnail Deleted State */
.page-thumbnail-card.deleted {
    opacity: 0.35;
    border-color: #cbd5e0;
    cursor: not-allowed;
    background-color: #edf2f7;
}

.page-thumbnail-card.deleted canvas {
    filter: grayscale(1) blur(0.5px);
}

.page-thumbnail-card.deleted:hover {
    box-shadow: none;
    transform: none;
    border-color: #cbd5e0;
}

.page-thumbnail-card.deleted .thumbnail-actions {
    display: flex;
}

.page-thumbnail-card.deleted .action-btn-small.delete {
    background-color: var(--secondary);
    border-color: var(--secondary);
    color: white;
}

.page-thumbnail-card.deleted .action-btn-small.delete:hover {
    background-color: var(--secondary-hover);
    border-color: var(--secondary-hover);
}

/* Page Number Placement Visual Selector */
.page-position-selector {
    background-color: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: grid;
    grid-template-rows: repeat(2, 60px);
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
}

.position-cell {
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
    background-color: var(--bg-main);
    user-select: none;
    text-align: center;
    padding: 4px;
}

.position-cell:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: var(--primary-light);
}

.position-cell.selected {
    border-color: var(--primary);
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(229, 62, 62, 0.2);
}

/* --- Advanced Mobile Responsiveness & Touch Adjustments (Corporate Standard) --- */
@media (max-width: 900px) {
    .thumbnail-actions {
        position: static !important;
        display: flex !important;
        justify-content: center;
        width: 100%;
        margin-top: 8px;
        gap: 8px;
    }
    .page-thumbnail-card {
        cursor: default; /* Drag-drop fallback via buttons */
        padding: 10px;
    }
    .nav-actions {
        order: 2;
        margin-left: auto;
        margin-right: 15px;
    }
    .menu-toggle {
        order: 3;
    }
}

@media (max-width: 600px) {
    .workspace-main {
        min-width: 100% !important;
    }
    .workspace-side {
        min-width: 100% !important;
        padding: 16px !important;
    }
    .pages-preview-box {
        padding: 16px 12px !important;
        margin-top: 15px;
    }
    .pages-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important;
        gap: 16px !important;
        padding: 4px !important;
    }
    .page-position-selector {
        padding: 12px !important;
        grid-template-rows: repeat(2, 50px) !important;
        gap: 8px !important;
    }
    .nav-actions {
        display: none !important; /* Hide header buttons on narrow viewports */
    }
}

@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    .tool-card {
        padding: 16px !important;
    }
    .hero h1 {
        font-size: 1.6rem !important;
    }
    .tool-header-info h2 {
        font-size: 1.7rem !important;
    }
}
