/* Global Styles */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #10b981;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --text-color: #f3f4f6;
    --text-muted: #94a3b8;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);
    --radius-lg: 16px;
    --radius-md: 8px;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--card-border) transparent;
}

body {
    background: var(--bg-dark);
    color: var(--text-color);
    font-family: var(--font-body);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
.logo,
.btn {
    font-family: var(--font-heading);
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-narrow {
    max-width: 900px;
}

.container-text {
    max-width: 800px;
}

.hidden {
    display: none !important;
}

/* Buttons & Inputs */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    gap: 8px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Navbar */
.navbar {
    padding: 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a:not(.btn) {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-links a:not(.btn):hover {
    color: var(--text-color);
}

/* Hero Section */
.hero-section {
    padding: 80px 0 100px;
    text-align: center;
    background: #0f172a;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--card-border);
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

.hero-animation-bg {
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(at 0% 0%, #312e81 0px, transparent 50%),
        radial-gradient(at 100% 0%, #4338ca 0px, transparent 50%),
        radial-gradient(at 100% 100%, #1e1b4b 0px, transparent 50%),
        radial-gradient(at 0% 100%, #3730a3 0px, transparent 50%),
        radial-gradient(at 50% 50%, #0f172a 0px, transparent 50%);
    background-size: 100% 100%;
    filter: blur(60px);
    opacity: 0.6;
    animation: rotateMesh 20s linear infinite alternate;
    z-index: 1;
}

.hero-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 1;
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
    pointer-events: none;
}

@keyframes rotateMesh {
    0% {
        transform: rotate(0deg) scale(1);
    }

    100% {
        transform: rotate(10deg) scale(1.1);
    }
}

.hero-section h1 {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(90deg, #ffffff 0%, #818cf8 25%, #c084fc 50%, #818cf8 75%, #ffffff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1.5px;
    line-height: 1.1;
    animation: textShimmer 6s linear infinite;
    position: relative;
    z-index: 2;
}

@keyframes textShimmer {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 650px;
    margin: 0 auto 40px;
    font-weight: 400;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 56px;
    flex-wrap: wrap;
}

.hero-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.95rem;
}

.hero-features svg {
    color: var(--secondary-color);
}

/* Tool Interface */
.tool-wrapper {
    max-width: 900px;
    margin: 0 auto;
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--card-border);
    border-radius: var(--radius-md);
    padding: 60px 20px;
    text-align: center;
    transition: 0.3s;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.upload-area p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.icon-upload {
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* Editor & Controls */
.tool-editor {
    animation: fadeIn 0.4s ease;
}

.file-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 30px;
}

.file-info-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Split Controls */
.controls-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

.sidebar-controls {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.control-group h4 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.premium-select,
.premium-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    padding: 12px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    transition: 0.2s;
}

.premium-select:focus,
.premium-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(15, 23, 42, 0.9);
}

.visual-selector-area {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    max-height: 500px;
}

.visual-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
    min-height: 200px;
}

.page-card {
    background: white;
    aspect-ratio: 0.7;
    /* Approximate A4 ratio */
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: 0.2s;
    border: 3px solid transparent;
}

.page-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.page-card.selected {
    border-color: var(--secondary-color);
}

.page-card.selected::after {
    content: '✓';
    position: absolute;
    inset: 0;
    background: rgba(16, 185, 129, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--secondary-color);
    font-weight: bold;
}

/* For "Remove Mode" */
.page-card.removed {
    opacity: 0.4;
    border-color: #ef4444;
}

.page-card.removed::after {
    content: '✕';
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    position: absolute;
    inset: 0;
}

.page-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.page-num {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    z-index: 2;
}

/* Toggles */
.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 10px;
    font-size: 0.95rem;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: #334155;
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: 0.3s;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary-color);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
}

/* Result View */
.result-view {
    text-align: center;
    padding: 40px;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    80% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 30px;
}

/* Loader */
.loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    border-radius: var(--radius-lg);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Content Blocks (SEO) */
.content-section {
    padding: 80px 0;
    border-top: 1px solid var(--card-border);
}

.content-block {
    margin-bottom: 60px;
    /* Feature Box Style for Text */
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    padding: 30px;
    border-radius: var(--radius-lg);
    transition: 0.3s;
}

.content-block:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--card-border);
}

.content-block h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: white;
    display: inline-block;
    position: relative;
}

.content-block h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    margin-top: 8px;
    border-radius: 2px;
}

.text-content p {
    font-size: 1.1rem;
    color: #cbd5e1;
    margin-bottom: 20px;
    line-height: 1.8;
}

.text-content h3 {
    color: white;
    font-size: 1.4rem;
    margin-top: 30px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.text-content h3::before {
    content: '→';
    color: var(--primary-color);
}

.text-content ul {
    margin-bottom: 20px;
    margin-left: 20px;
}

.text-content li {
    margin-bottom: 12px;
    list-style-type: none;
    color: #cbd5e1;
    position: relative;
    padding-left: 25px;
}

.text-content li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-weight: bold;
}

/* Detailed FAQ Styling */
.faq-list h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 50px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.faq-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.05);
}

.faq-question {
    padding: 24px;
    margin: 0;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question::after {
    transform: rotate(45deg);
}

.faq-item.active .faq-question {
    color: var(--primary-color);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
    background: rgba(15, 23, 42, 0.3);
}

.faq-item.active .faq-answer {
    max-height: 500px;
    /* enough for content */
    transition: max-height 0.5s ease;
    border-top: 1px solid var(--card-border);
}

.faq-text {
    padding: 24px;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.7;
}

/* Explore More Tools Section */
.explore-tools-section {
    padding: 60px 0;
    background: var(--bg-darker);
    border-top: 1px solid var(--card-border);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.tool-card {
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 30px;
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.tool-icon {
    width: 60px;
    height: 60px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.tool-card h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
    color: white;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.arrow-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 15px;
    color: var(--primary-color);
    font-weight: 500;
}

/* Footer (Updated to match request) */
.main-footer {
    background: #000;
    border-top: 1px solid #1e293b;
    padding-top: 80px;
    padding-bottom: 40px;
}

.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

.footer-col h4 {
    color: white;
    margin-bottom: 24px;
    font-size: 1.1rem;
}

.footer-col a {
    display: block;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.footer-col a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.brand-col p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 300px;
    margin-top: 16px;
}

.footer-bottom {
    padding-top: 32px;
    border-top: 1px solid #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-bottom p {
    color: #64748b;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .controls-grid {
        grid-template-columns: 1fr;
    }

    .hero-section h1 {
        font-size: 2.5rem;
    }

    .file-preview-header {
        flex-direction: column;
        gap: 15px;
    }

    .footer-top {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 20px;
    }
}