:root {
    --primary: #29b5cc;
    --secondary: #24213b;
    --accent: #3eb984;
    --bg-light: #f5f5f5;
    --text-dark: #24213b;
    --text-light: #666;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    font-weight: normal;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: block;
    width: 100%;
}

/* ---------- Header & Nav ---------- */
header {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-icon {
    height: 45px;
    width: auto;
}

.logo-text {
    height: 35px;
    width: auto;
}

#nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: static;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

#nav-menu a,
#nav-menu .dropbtn {
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    transition: color 0.3s;
    padding: 0.5rem 0;
}

#nav-menu a:hover,
#nav-menu .dropbtn:hover {
    color: var(--primary);
}

.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    top: 100%;
    left: 0;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 8px 0;
    z-index: 1000;
    margin-top: 8px;
    border: 1px solid #e0e0e0;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px 12px 24px;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    position: relative;
}

.dropdown-content a i {
    width: 20px;
    text-align: center;
    color: var(--primary);
}

.dropdown-content a:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--primary);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.dropdown-content a:hover {
    background-color: #f8f9fa;
    color: var(--primary);
    padding-left: 28px;
}

.dropdown-content a:hover:before {
    transform: scaleY(1);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-dark);
}

/* ---------- Hero Section ---------- */
.hero {
    background: white;
    padding: 3rem 5%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.hero-text {
    flex: 1 1 45%;
}

.hero-text h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-weight: 600;
}

.hero-text p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.btn-large {
    padding: 14px 32px;
    font-size: 1.1rem;
}

.hero-img {
    flex: 1 1 45%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-img video {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* ---------- Content Pages ---------- */
.content-page {
    max-width: 900px;
    margin: 40px auto;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.page-header h1 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.content-section {
    margin-bottom: 2rem;
}

.content-section h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-weight: 600;
}

.content-section p {
    font-size: 1rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    padding: 12px 0;
    font-size: 1rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.feature-list i {
    color: var(--primary);
    font-size: 1.2rem;
}

.content-actions {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #f0f0f0;
}

/* ---------- Contact Page ---------- */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin: 2rem 0;
}

.contact-form-section h2,
.contact-info-section h2 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: #f8f9fa;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.contact-form textarea {
    resize: vertical;
    font-family: inherit;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.contact-item i {
    font-size: 1.5rem;
    color: var(--primary);
    margin-top: 4px;
}

.contact-item strong {
    display: block;
    color: var(--text-dark);
    margin-bottom: 4px;
    font-size: 1rem;
}

.contact-item p {
    color: var(--text-light);
    margin: 0;
    font-size: 0.95rem;
}

.description {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.privacy-note {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ---------- Upload Panel ---------- */
.upload-panel {
    background: #fff;
    margin: 40px auto;
    padding: 40px;
    border-radius: 8px;
    max-width: 1200px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.upload-panel h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 600;
}

.upload-panel .subtitle {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    font-weight: normal;
}

.form-section {
    margin-bottom: 1.5rem;
    text-align: left;
}

.section-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.file-input {
    width: 100%;
    padding: 12px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    background-color: #f8f9fa;
    transition: border-color 0.3s;
}

.file-input:hover {
    border-color: var(--primary);
}

.redact-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
    background-color: #f8f9fa;
}

.redact-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 1.5rem 0;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.checkbox-wrapper label {
    font-size: 0.95rem;
    color: var(--text-dark);
    cursor: pointer;
    margin: 0;
    font-weight: normal;
}

.btn-submit {
    width: 100%;
    max-width: 300px;
    padding: 12px 24px;
    font-size: 1rem;
    margin-top: 1rem;
}

/* ---------- Toolbar ---------- */

.top-toolbar {
    position: relative; /* Changed from sticky to relative since parent is fixed */
    top: 0;
    z-index: 10002;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 12px;
    padding: 0.5rem 1rem; /* Reduced from 0.75rem */

    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);

    flex-wrap: wrap;
}

/* ===== Button Base ===== */
.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 10px 16px;
    border-radius: 10px;

    border: 2px solid var(--text-light);
    background: white;
    color: var(--text-light);

    font-weight: 600;
    font-size: 16px;
    line-height: 1;

    cursor: pointer;
    user-select: none;
    transition: all 0.18s ease;
}

.toolbar-btn i {
    font-size: 16px;
}

/* Hover */
.toolbar-btn:hover {
    background: var(--bg-light);
    border-color: var(--text-light);
    color: var(--text-light);
}

/* ===== Active mode button ===== */
.mode-toggle .toolbar-btn.is-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.mode-toggle .toolbar-btn.is-active:hover {
    background: var(--secondary);
    border-color: var(--secondary);
    color: white;
}

/* ===== Mode Toggle Layout (keep side-by-side) ===== */
.mode-toggle {
    display: flex;
    flex-direction: row;
    gap: 16px;
    flex-wrap: nowrap;
    align-items: center;
}

/* Prevent wrap caused by long labels */
.mode-toggle .toolbar-btn {
    white-space: nowrap;
    min-width: 190px;   /* matches your screenshot layout */
}

/* ===== Right side actions ===== */
.toolbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Apply button */
.toolbar-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

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

/* Icon-only buttons */
.icon-btn {
    width: 54px;
    height: 54px;
    padding: 0;
    border-radius: 12px;
}

/* Download button specific styling */
.toolbar-btn.download {
    border-color: var(--accent);
    color: var(--accent);
}

.toolbar-btn.download:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ===== Context Toolbar ===== */
.context-toolbar {
    position: relative; /* Changed from default to relative since parent is fixed */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px; /* Reduced from 12px */

    background: var(--bg-light);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.toolbar-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

/* ===== PDF Page Container ===== */
.pdf-page-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-light);
}

/* ===== Fixed Toolbar Section ===== */
.toolbar-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10100;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== Scrollable PDF Section ===== */
.pdf-scroll-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 100px; /* Reduced from 120px - Space for fixed toolbars */
    padding-left: 12px; /* Reduced from 20px */
    padding-right: 12px; /* Reduced from 20px */
    padding-bottom: 12px; /* Reduced from 20px */
    scroll-behavior: smooth; /* Smooth scrolling */
}

/* ===== PDF Wrapper (Legacy - keeping for compatibility) ===== */
.pdf-page-wrapper {
    height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: var(--bg-light);
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    .top-toolbar {
        justify-content: space-between;
    }

    .mode-toggle {
        flex-wrap: wrap;       /* allow wrap on mobile */
        justify-content: center;
    }

    .mode-toggle .toolbar-btn {
        min-width: 160px;
    }

    /* Adjust padding for mobile with new layout */
    .pdf-scroll-container {
        padding-top: 110px; /* Reduced from 140px - More space for wrapped toolbars on mobile */
    }
}

.download-icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cta-btn {
    background-color: var(--primary);
    color: white;
    padding: 0.8rem 2rem;
    font-weight: bold;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
    box-shadow: 0 4px 14px rgba(29, 130, 174, 0.2);
}

.cta-btn:hover {
    background-color: #176b8d;
}

/* ---------- Chat Styles ---------- */
.chat-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

.chat-header {
    background: white;
    border-radius: 8px 8px 0 0;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.chat-header h1 {
    color: #24213b;
    margin-bottom: 8px;
}

.chat-header p {
    color: #666;
    font-size: 1rem;
}

.chat-wrapper {
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 24px;
}

.chatbox {
    min-height: 400px;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    background-color: #f8f9fa;
}

.message {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    line-height: 1.5;
}

.message.user {
    background-color: #e3f2fd;
    color: #1976d2;
    margin-left: 20%;
    text-align: right;
    border-left: 4px solid var(--accent);
}

.message.bot {
    background-color: #f8f9fa;
    color: #333;
    margin-right: 20%;
    border: 1px solid #ddd;
    border-left: 4px solid var(--primary);
}

.message strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.chat-input-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#chat-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

#chat-input:focus {
    outline: none;
    border-color: #29b5cc;
}

.button-group {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

.btn-secondary {
    background-color: var(--text-light);
    color: white;
    border-color: var(--text-light);
}

.btn-secondary:hover {
    background-color: var(--text-dark);
    border-color: var(--text-dark);
}

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

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

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

.btn-outline-secondary {
    background-color: transparent;
    color: var(--text-light);
    border-color: var(--text-light);
}

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

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

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



/* ---------- Footer ---------- */
footer {
    background: white;
    border-top: 1px solid #ddd;
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.9rem;
    color: #999;
}

/* ---------- Mobile Styles ---------- */
@media (max-width: 768px) {
    header {
        padding: 0.6rem 1rem;
    }

    .logo-icon {
        height: 35px;
    }

    .logo-text {
        height: 28px;
    }

    .menu-toggle {
        display: block;
    }

    #nav-menu {
        display: none;
        flex-direction: column;
        background-color: white;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        padding: 1rem;
        z-index: 999;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    }

    #nav-menu.show {
        display: flex;
    }

    #nav-menu a,
    #nav-menu .dropbtn {
        margin: 0.5rem 0;
        font-size: 1rem;
        display: block;
        text-align: center;
        padding: 0.5rem;
    }

    .upload-panel {
        margin: 20px;
        padding: 24px;
    }

    .upload-panel h1 {
        font-size: 1.5rem;
    }

    .checkbox-wrapper {
        flex-direction: row;
        justify-content: center;
    }

    .dropdown:hover .dropdown-content {
        display: none;
    }

    .dropdown .dropdown-content {
        display: none;
        position: static;
        background: white;
        box-shadow: none;
        padding-left: 0;
    }

    .dropdown.active .dropdown-content {
        display: block;
    }

    .dropdown-content a {
        padding: 10px 16px;
        display: block;
        border-bottom: 1px solid #eee;
    }

    .hero {
        flex-direction: column;
        text-align: center;
        padding: 2rem 1rem;
    }

    .hero-text {
        margin: 0;
    }

    .hero-text h1 {
        font-size: 1.8rem;
    }

    .hero-text p {
        font-size: 1rem;
    }

    .content-page {
        margin: 20px;
        padding: 24px;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .content-section h2 {
        font-size: 1.2rem;
    }

    .contact-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }



    /* Chat mobile styles */
    .chat-container {
        padding: 12px;
    }

    .chat-header {
        padding: 16px;
    }

    .chat-header h1 {
        font-size: 1.5rem;
    }

    .chat-wrapper {
        padding: 16px;
    }

    .chatbox {
        min-height: 300px;
        max-height: 400px;
    }

    .message.user {
        margin-left: 10%;
    }

    .message.bot {
        margin-right: 10%;
    }

    .button-group {
        flex-direction: column;
        gap: 8px;
    }

    .button-group .btn {
        width: 100%;
        justify-content: center;
    }

    .top-toolbar {
        gap: 12px;
        padding: 0.5rem; /* Reduced from 0.75rem */
        flex-wrap: wrap;
    }

    .toolbar-actions {
        gap: 0.25rem;
    }

    .context-toolbar {
        gap: 8px;
        padding: 8px;
        flex-wrap: wrap;
    }
}


/* ---------- PDF Viewer Page ---------- */
.pdf-panel {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    overflow-x: hidden;
}

.pdf-viewer {
    position: relative;
    z-index: 1; /* Keep below toolbar (z-index: 10100) */
    margin-top: 0; /* Removed margin since we have padding-top on container */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    overflow-x: hidden;
    width: 100%;
    min-height: calc(100vh - 120px); /* Reduced from 140px - Ensure minimum height for proper scrolling */
}

#pdf-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

#pdf-container canvas {
    max-width: 100%;
    width: auto;
    height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

#pdfCanvas {
    max-width: 100%;
    width: auto;
    height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    display: block;
}

/* PDF Text Box Styles */
.pdf-textbox {
    padding: 5px;
    min-width: 150px;
    outline: none;
}

.pdf-textbox:focus {
    border-color: #0066cc;
    box-shadow: 0 0 5px rgba(0, 102, 204, 0.5);
}

.btn-group {
    display: inline-flex;
    vertical-align: middle;
}

.btn-group .btn {
    margin: 0;
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}



#text-controls {
    vertical-align: middle;
}

#text-controls select,
#text-controls input {
    height: 38px;
    vertical-align: middle;
}

.pdf-viewer canvas {
    display: block;
    margin-bottom: 10px;
}

/* Error Page Styles */
.error-page-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 2rem;
}

.error-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 3rem 2.5rem;
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.error-icon {
    font-size: 4rem;
    color: #ff6b6b;
    margin-bottom: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.error-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.error-subtitle {
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.error-reasons {
    list-style: none;
    text-align: left;
    margin: 0 auto 2rem;
    max-width: 400px;
    padding: 0;
}

.error-reasons li {
    padding: 0.5rem 0;
    color: var(--text-light);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.error-reasons li i {
    font-size: 0.4rem;
    color: var(--primary);
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.error-actions .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

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

.error-actions .btn-primary:hover {
    background: #1fa3ba;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(41, 181, 204, 0.3);
}

.error-actions .btn-secondary {
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--primary);
}

.error-actions .btn-secondary:hover {
    background: var(--bg-light);
    transform: translateY(-2px);
}

.error-help {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9rem;
    color: var(--text-light);
}

.error-help a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.error-help a:hover {
    color: #1fa3ba;
    text-decoration: underline;
}

/* Responsive Error Page */
@media (max-width: 768px) {
    .error-panel {
        padding: 2rem 1.5rem;
    }

    .error-title {
        font-size: 1.5rem;
    }

    .error-icon {
        font-size: 3rem;
    }

    .error-actions {
        flex-direction: column;
    }

    .error-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Chat Markdown Styling */
.markdown-content {
    margin-top: 0.5rem;
    line-height: 1.6;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    color: var(--text-dark);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.markdown-content h2 {
    font-size: 1.3rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.3rem;
}

.markdown-content h3 {
    font-size: 1.1rem;
    color: var(--primary);
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.markdown-content li {
    margin-bottom: 0.3rem;
}

.markdown-content strong {
    color: var(--text-dark);
    font-weight: 600;
}

.markdown-content p {
    margin-bottom: 0.75rem;
}

.markdown-content code {
    background-color: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin-left: 0;
    color: var(--text-light);
    font-style: italic;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.75rem 0;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #ddd;
    padding: 0.5rem;
    text-align: left;
}

.markdown-content th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

.markdown-content tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Loading indicator */
.typing-indicator {
    display: inline-block;
    animation: blink 1.4s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.message.loading {
    opacity: 0.7;
}

.message.error {
    background-color: #ffebee;
    border-left: 4px solid #f44336;
}

/* Upload Page Checkbox Styling */
.redaction-options {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

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

.option-group {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e9ecef;
}

.group-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s;
    font-size: 0.9rem;
    position: relative;
}

.checkbox-item:hover {
    background-color: rgba(41, 181, 204, 0.1);
}

.checkbox-item input[type="checkbox"],
.section-checkbox-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.checkmark {
    height: 18px;
    width: 18px;
    background-color: white;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.3s;
    flex-shrink: 0;
}

.checkbox-item:hover .checkmark {
    border-color: var(--primary);
}

.checkbox-item input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-item input:checked ~ .checkmark:after {
    display: block;
}

.selection-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0.75rem 1rem 0.5rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-small i {
    margin-right: 0.4rem;
    font-size: 0.8rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .selection-controls {
        flex-direction: column;
    }

    .btn-small {
        width: 100%;
    }

    .redaction-options {
        padding: 1rem;
    }
}

/* Animation for checkbox selection */
@keyframes checkboxPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.checkbox-item input:checked ~ .checkmark {
    animation: checkboxPulse 0.3s ease;
}

/* Collapsible Sections Styling */
.collapsible-section {
    background: white;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.collapsible-section:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    transition: background-color 0.3s ease;
}

.section-header:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.section-checkbox-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex: 1;
    margin: 0;
}

.section-checkbox-item .group-title {
    margin: 0 0 0 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    border: none;
    padding: 0;
}

.collapse-icon {
    font-size: 1rem;
    color: var(--primary);
    transition: transform 0.3s ease;
    margin-left: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.collapse-icon:hover {
    background-color: rgba(41, 181, 204, 0.1);
    transform: scale(1.1);
}

.section-content {
    padding: 1.25rem;
    background: white;
    transition: all 0.3s ease;
}

.section-content.collapsed {
    display: none;
}

/* Custom Redaction Area */
.custom-redaction-area {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e9ecef;
}

.custom-label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.custom-textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s ease;
    background: white;
}

.custom-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(41, 181, 204, 0.1);
}

.custom-textarea::placeholder {
    color: #6c757d;
    font-style: italic;
}

.custom-help {
    display: flex;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.custom-help i {
    margin-right: 0.5rem;
    color: var(--primary);
}

/* Indeterminate checkbox styling */
input[type="checkbox"]:indeterminate + .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"]:indeterminate + .checkmark:after {
    content: "";
    position: absolute;
    display: block;
    left: 3px;
    top: 7px;
    width: 10px;
    height: 2px;
    background: white;
    border: none;
    transform: none;
}

/* Section content animations */
.section-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.section-content[style*="display: none"] {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Improved grid layout for sections */
.redaction-options {
    background: transparent;
    padding: 0;
    box-shadow: none;
}

/* Enhanced checkbox styling for sections */
.section-checkbox-item .checkmark {
    height: 20px;
    width: 20px;
    margin-right: 0.75rem;
    border-width: 2px;
}

.section-checkbox-item:hover .checkmark {
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Responsive improvements */
@media (max-width: 768px) {
    .section-header {
        padding: 0.75rem 1rem;
    }

    .section-content {
        padding: 1rem;
    }

    .selection-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-small {
        width: 100%;
        justify-content: center;
    }

    .custom-textarea {
        min-height: 100px;
    }
}

/* Loading state for sections */
.section-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Section counter badge */
.section-counter {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    margin-left: 0.5rem;
    font-weight: 600;
}

/* Enhanced hover effects */
.collapsible-section:hover .collapse-icon {
    transform: scale(1.1);
    color: #1fa3ba;
}

.section-header:active {
    transform: translateY(1px);
}/* Sec
tion title without checkbox */
.section-title-item {
    display: flex;
    align-items: center;
    flex: 1;
}

.section-title-item .group-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    border: none;
    padding: 0;
}

.overlay-box:hover {
  box-shadow: 0 0 6px rgba(255,0,0,0.8);
}

/* ---------- Tab Navigation Styles ---------- */
.tab-navigation {
    display: flex;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0;
    overflow: hidden;
}

.tab-button {
    flex: 1;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

.tab-button:hover {
    background: rgba(41, 181, 204, 0.1);
    color: var(--primary);
}

.tab-button.active {
    background: white;
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: white;
}

.tab-button i {
    font-size: 1.1rem;
}

/* Tab Content Styles */
.tab-content {
    display: none;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Add Options Styling */
.add-options {
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.add-options .collapsible-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.add-options .section-header {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border-bottom: 1px solid #c3e6cb;
}

.add-options .section-header:hover {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.add-options .collapse-icon {
    color: var(--accent);
}

.add-options .collapse-icon:hover {
    background-color: rgba(62, 185, 132, 0.1);
}

.add-options .checkbox-item:hover {
    background-color: rgba(62, 185, 132, 0.1);
}

.add-options .checkbox-item input:checked ~ .checkmark {
    background-color: var(--accent);
    border-color: var(--accent);
}

.add-options .checkbox-item:hover .checkmark {
    border-color: var(--accent);
}

/* File Info Item Styling */
.file-info-item {
    color: var(--text-dark);
    font-weight: 500;
}

/* Responsive Tab Styles */
@media (max-width: 768px) {
    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .tab-button i {
        font-size: 1rem;
    }

    .tab-content {
        padding: 1rem;
    }

    .tab-navigation {
        border-radius: 6px 6px 0 0;
    }

    .tab-content {
        border-radius: 0 0 6px 6px;
    }
}

/* Enhanced Tab Button States */
.tab-button:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(41, 181, 204, 0.3);
}

.tab-button:active {
    transform: translateY(1px);
}

/* Tab Content Loading State */
.tab-content.loading {
    opacity: 0.6;
    pointer-events: none;
}

.tab-content.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}/* 
---------- Horizontal Sections Layout ---------- */
.horizontal-sections-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.section-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
}

.section-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Panel Headers */
.panel-header {
    padding: 1.5rem 1.75rem 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.panel-title i {
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.panel-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    letter-spacing: -0.02em;
}

/* Panel Controls */
.panel-controls {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.control-btn:hover {
    background: white;
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.control-btn i {
    font-size: 0.9rem;
}

/* Panel Content */
.panel-content {
    padding: 0 1.75rem 1.5rem;
    max-height: 600px;
    overflow-y: auto;
}

.panel-content::-webkit-scrollbar {
    width: 6px;
}

.panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Redact Panel Styling */
.redact-panel .panel-title i {
    color: var(--primary);
    background: rgba(41, 181, 204, 0.1);
}

.redact-panel .panel-header {
    background: linear-gradient(135deg, rgba(41, 181, 204, 0.05) 0%, rgba(41, 181, 204, 0.02) 100%);
    border-bottom: 1px solid rgba(41, 181, 204, 0.1);
}

.redact-panel .control-btn:hover {
    color: var(--primary);
    background: rgba(41, 181, 204, 0.1);
}

/* Add Panel Styling */
.add-panel .panel-title i {
    color: var(--accent);
    background: rgba(62, 185, 132, 0.1);
}

.add-panel .panel-header {
    background: linear-gradient(135deg, rgba(62, 185, 132, 0.05) 0%, rgba(62, 185, 132, 0.02) 100%);
    border-bottom: 1px solid rgba(62, 185, 132, 0.1);
}

.add-panel .control-btn:hover {
    color: var(--accent);
    background: rgba(62, 185, 132, 0.1);
}

/* Enhanced Collapsible Sections for Horizontal Layout */
.horizontal-sections-container .collapsible-section {
    margin-bottom: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.horizontal-sections-container .section-header {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #fafbfc 0%, #f1f3f4 100%);
    border-radius: 12px 12px 0 0;
}

.horizontal-sections-container .section-content {
    padding: 1rem 1.25rem;
    border-radius: 0 0 12px 12px;
}

/* Smooth Animations */
.section-content {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.collapse-icon {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    margin-bottom: 0.25rem;
}

.checkbox-item:hover {
    background: rgba(0, 0, 0, 0.02);
    transform: translateX(2px);
}

.checkmark {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-item input:checked ~ .checkmark {
    transform: scale(1.1);
}

/* Enhanced Visual Effects */
.section-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.section-panel:hover::before {
    opacity: 1;
}

.redact-panel::before {
    background: linear-gradient(90deg, var(--primary), #1fa3ba);
}

.add-panel::before {
    background: linear-gradient(90deg, var(--accent), #2ea572);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .horizontal-sections-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .panel-header {
        padding: 1.25rem 1.5rem 0.75rem;
    }

    .panel-content {
        padding: 0 1.5rem 1.25rem;
        max-height: 500px;
    }

    .control-btn {
        width: 32px;
        height: 32px;
    }

    .panel-title h3 {
        font-size: 1rem;
    }

    .panel-title i {
        font-size: 1.1rem;
        padding: 0.4rem;
    }
}

@media (max-width: 768px) {
    .horizontal-sections-container {
        gap: 0.75rem;
    }

    .section-panel {
        border-radius: 12px;
    }

    .panel-header {
        padding: 1rem 1.25rem 0.5rem;
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .panel-controls {
        align-self: stretch;
        justify-content: center;
    }

    .panel-content {
        padding: 0 1.25rem 1rem;
        max-height: 400px;
    }

    .panel-title {
        align-self: center;
    }
}

/* Hide old tab elements if they exist */
.tab-navigation,
.tab-button,
.tab-content {
    display: none !important;
}/* -
--------- Text Controls Checkbox Styling ---------- */
.context-toolbar .checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.context-toolbar .checkbox-wrapper:hover {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(41, 181, 204, 0.1);
}

.context-toolbar .form-check-input {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

.context-toolbar .form-check-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.context-toolbar .checkbox-wrapper:hover .form-check-label {
    color: var(--primary);
}

/* Responsive adjustments for text controls */
@media (max-width: 768px) {
    .context-toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .context-toolbar .checkbox-wrapper {
        order: 1;
        flex: 1 1 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }
}