:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    padding: 0;
    width: 100%;
}

/* Card Styles (Used for Error/Upload) */
.upload-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--glass-shadow);
    text-align: center;
    transition: transform 0.3s ease;
    margin: 2rem;
}

.upload-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    line-height: 1.6;
}

.upload-card h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Viewer Styles */
.viewer-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;

    :root {
        --primary-color: #4f46e5;
        --primary-hover: #4338ca;
        --bg-color: #ffffff;
        --text-color: #1e293b;
        --text-muted: #64748b;
        --glass-bg: rgba(255, 255, 255, 0.8);
        --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    body {
        font-family: 'Outfit', sans-serif;
        background-color: var(--bg-color);
        color: var(--text-color);
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        overflow-x: hidden;
    }

    .container {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        width: 100%;
    }

    /* Card Styles (Used for Error/Upload) */
    .upload-card {
        background: var(--glass-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid #e2e8f0;
        border-radius: 24px;
        padding: 3rem;
        width: 100%;
        max-width: 500px;
        box-shadow: var(--glass-shadow);
        text-align: center;
        transition: transform 0.3s ease;
        margin: 2rem;
    }

    .upload-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
        line-height: 1.6;
    }

    .upload-card h1 {
        font-size: 2.5rem;
        font-weight: 700;
        margin-bottom: 0.5rem;
        background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .subtitle {
        color: var(--text-muted);
        margin-bottom: 2rem;
        font-size: 1.1rem;
        line-height: 1.6;
    }

    /* Viewer Styles */
    .viewer-container {
        width: 100%;
        height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: relative;
        background: #ffffff;
        overflow: hidden;
    }

    .toolbar {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        height: auto;
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 16px;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 100;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
        padding: 0.75rem 1.5rem;
    }

    .tool-group {
        display: flex;
        align-items: center;
        gap: 1.5rem;
    }

    .tool-btn {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.75rem;
        border-radius: 12px;
        color: var(--text-color);
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .tool-btn:hover {
        background: rgba(79, 70, 229, 0.1);
        color: var(--primary-color);
        transform: translateY(-2px);
    }

    .page-info {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-color);
        min-width: 120px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .page-input {
        width: 50px;
        padding: 0.5rem;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        text-align: center;
        font-family: inherit;
        font-size: 1rem;
        background: rgba(255, 255, 255, 0.5);
        transition: all 0.2s;
    }

    .page-input:focus {
        background: white;
        border-color: var(--primary-color);
        outline: none;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

    .pdf-select {
        padding: 0.5rem 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background-color: rgba(255, 255, 255, 0.5);
        color: var(--text-color);
        font-family: inherit;
        font-size: 0.95rem;
        cursor: pointer;
        outline: none;
        transition: all 0.2s;
        min-width: 180px;
    }

    .pdf-select:hover {
        border-color: var(--primary-color);
        background: white;
    }

    .pdf-select:focus {
        border-color: var(--primary-color);
        background: white;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

    .divider {
        width: 1px;
        height: 32px;
        background-color: #cbd5e1;
        margin: 0 0.5rem;
    }

    .doc-title {
        display: none;
    }

    .flipbook-wrapper {
        width: 100%;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        padding: 40px;
        background: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
    }

    .flipbook {
        max-width: 100%;
        max-height: 100%;
        background: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
    }

    .flipbook {
        max-width: 100%;
        max-height: 100%;
        box-shadow:
            0 20px 25px -5px rgba(0, 0, 0, 0.1),
            0 10px 10px -5px rgba(0, 0, 0, 0.04),
            0 0 0 1px rgba(0, 0, 0, 0.05);
        /* Subtle border */
        transition: box-shadow 0.3s ease;
    }

    .page {
        background-color: white;
        overflow: hidden;
    }

    .page canvas {
        left: 0;
        width: 100%;
        height: 100%;
        background: #ffffff;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 1000;
    }

    .spinner {
        width: 40px;
        height: 40px;
        border: 3px solid rgba(79, 70, 229, 0.1);
        border-radius: 50%;
        border-top-color: var(--primary-color);
        animation: spin 0.8s linear infinite;
        margin-bottom: 1rem;
    }

    @keyframes spin {
        margin-bottom: 0.5rem;
        background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .subtitle {
        color: var(--text-muted);
        margin-bottom: 2rem;
        font-size: 1.1rem;
        line-height: 1.6;
    }

    /* Viewer Styles */
    .viewer-container {
        width: 100%;
        height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: relative;
        background: #ffffff;
        overflow: hidden;
    }

    .toolbar {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        height: auto;
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 16px;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 100;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
        padding: 0.75rem 1.5rem;
    }

    .tool-group {
        display: flex;
        align-items: center;
        gap: 1.5rem;
    }

    .tool-btn {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.75rem;
        border-radius: 12px;
        color: var(--text-color);
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .tool-btn:hover {
        background: rgba(79, 70, 229, 0.1);
        color: var(--primary-color);
        transform: translateY(-2px);
    }

    .page-info {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-color);
        min-width: 120px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .page-input {
        width: 50px;
        padding: 0.5rem;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        text-align: center;
        font-family: inherit;
        font-size: 1rem;
        background: rgba(255, 255, 255, 0.5);
        transition: all 0.2s;
    }

    .page-input:focus {
        background: white;
        border-color: var(--primary-color);
        outline: none;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

    .pdf-select {
        padding: 0.5rem 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background-color: rgba(255, 255, 255, 0.5);
        color: var(--text-color);
        font-family: inherit;
        font-size: 0.95rem;
        cursor: pointer;
        outline: none;
        transition: all 0.2s;
        min-width: 180px;
    }

    .pdf-select:hover {
        border-color: var(--primary-color);
        background: white;
    }

    .pdf-select:focus {
        border-color: var(--primary-color);
        background: white;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

    .divider {
        width: 1px;
        height: 32px;
        background-color: #cbd5e1;
        margin: 0 0.5rem;
    }

    .doc-title {
        display: none;
    }

    .flipbook-wrapper {
        width: 100%;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        padding: 40px;
        background: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
    }

    .flipbook {
        max-width: 100%;
        max-height: 100%;
        background: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
    }

    .flipbook {
        max-width: 100%;
        max-height: 100%;
        box-shadow:
            0 20px 25px -5px rgba(0, 0, 0, 0.1),
            0 10px 10px -5px rgba(0, 0, 0, 0.04),
            0 0 0 1px rgba(0, 0, 0, 0.05);
        /* Subtle border */
        transition: box-shadow 0.3s ease;
    }

    .page {
        background-color: white;
        overflow: hidden;
    }

    .page canvas {
        left: 0;
        width: 100%;
        height: 100%;
        background: #ffffff;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 1000;
    }

    .spinner {
        width: 40px;
        height: 40px;
        border: 3px solid rgba(79, 70, 229, 0.1);
        border-radius: 50%;
        border-top-color: var(--primary-color);
        animation: spin 0.8s linear infinite;
        margin-bottom: 1rem;
    }

    @keyframes spin {
        margin-bottom: 0.5rem;
        background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .subtitle {
        color: var(--text-muted);
        margin-bottom: 2rem;
        font-size: 1.1rem;
        line-height: 1.6;
    }

    /* Viewer Styles */
    .viewer-container {
        width: 100%;
        height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: relative;
        background: #ffffff;
        overflow: hidden;
    }

    .toolbar {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        height: auto;
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 16px;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 100;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
        padding: 0.75rem 1.5rem;
    }

    .tool-group {
        display: flex;
        align-items: center;
        gap: 1.5rem;
    }

    .tool-btn {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.75rem;
        border-radius: 12px;
        color: var(--text-color);
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .tool-btn:hover {
        background: rgba(79, 70, 229, 0.1);
        color: var(--primary-color);
        transform: translateY(-2px);
    }

    .page-info {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-color);
        min-width: 120px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .page-input {
        width: 50px;
        padding: 0.5rem;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        text-align: center;
        font-family: inherit;
        font-size: 1rem;
        background: rgba(255, 255, 255, 0.5);
        transition: all 0.2s;
    }

    .page-input:focus {
        background: white;
        border-color: var(--primary-color);
        outline: none;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

    .pdf-select {
        padding: 0.5rem 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background-color: rgba(255, 255, 255, 0.5);
        color: var(--text-color);
        font-family: inherit;
        font-size: 0.95rem;
        cursor: pointer;
        outline: none;
        transition: all 0.2s;
        min-width: 180px;
    }

    .pdf-select:hover {
        border-color: var(--primary-color);
        background: white;
    }

    .pdf-select:focus {
        border-color: var(--primary-color);
        background: white;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

    .divider {
        width: 1px;
        height: 32px;
        background-color: #cbd5e1;
        margin: 0 0.5rem;
    }

    .doc-title {
        display: none;
    }

    .flipbook-wrapper {
        width: 100%;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        padding: 40px;
        background: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
    }

    .flipbook {
        max-width: 100%;
        max-height: 100%;
        background: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
    }

    .flipbook {
        max-width: 100%;
        max-height: 100%;
        box-shadow:
            0 20px 25px -5px rgba(0, 0, 0, 0.1),
            0 10px 10px -5px rgba(0, 0, 0, 0.04),
            0 0 0 1px rgba(0, 0, 0, 0.05);
        /* Subtle border */
        transition: box-shadow 0.3s ease;
    }

    .page {
        background-color: white;
        overflow: hidden;
    }

    .page canvas {
        left: 0;
        width: 100%;
        height: 100%;
        background: #ffffff;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 1000;
    }

    .spinner {
        width: 40px;
        height: 40px;
        border: 3px solid rgba(79, 70, 229, 0.1);
        border-radius: 50%;
        border-top-color: var(--primary-color);
        animation: spin 0.8s linear infinite;
        margin-bottom: 1rem;
    }

    @keyframes spin {
        to {
            transform: rotate(360deg);
        }
    }

    .loading-overlay.hidden {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.5s ease;
    }

    .company-logo {
        height: 32px;
        width: auto;
        margin-right: 0.5rem;
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    }