:root {
    --bg-dark: #f0f9ff;
    /* Light Blueish White */
    --bg-card: #ffffff;
    --primary: #2563eb;
    --primary-glow: rgba(37, 99, 235, 0.2);
    --secondary: #94a3b8;
    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    --danger: #ef4444;
    --success: #16a34a;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px var(--primary-glow);
}

.input-field {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 0.5rem;
    width: 100%;
    outline: none;
    transition: all 0.3s;
}

.input-field:focus {
    border-color: var(--primary);
}

/* Upload Area */
.upload-zone {
    border: 2px dashed var(--secondary);
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.02);
}

.upload-zone:hover,
.upload-zone.active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

/* Grid for Pages */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.page-card {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid transparent;
}

.page-card:hover {
    transform: scale(1.03);
}

.page-card.selected {
    border-color: var(--success);
}

.page-card.blurred {
    border-color: var(--primary);
}

.page-card.deleted {
    opacity: 0.4;
    border-color: var(--danger);
}

.page-card img {
    width: 100%;
    height: auto;
    display: block;
}

.page-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
}

.badge-show {
    background-color: var(--success);
}

.badge-blur {
    background-color: var(--primary);
}

.badge-delete {
    background-color: var(--danger);
}

/* Loader */
.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--secondary);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Flipbook Viewer Specifics */
#book {
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.page-content {
    background-color: white;
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.blur-overlay {
    position: absolute;
    inset: 0;
    /* backdrop-filter: blur(8px) handled by canvas pre-process, but we add a dark tint here */
    background: rgba(0, 0, 0, 0.1);

    /* Mobile-First Step Design */
    .step-card {
        background: white;
        padding: 1.5rem;
        border-radius: 1rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        margin-bottom: 2rem;
        border: 1px solid #e2e8f0;
    }

    .step-header {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        margin-bottom: 1.5rem;
        border-bottom: 2px solid #f1f5f9;
        padding-bottom: 1rem;
    }

    .step-number {
        background: var(--primary);
        color: white;
        width: 35px;
        height: 35px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 1.2rem;
    }

    .step-title {
        font-size: 1.25rem;
        font-weight: bold;
        color: var(--text-main);
    }

    /* Mobile Responsiveness & Simplification */
    @media (max-width: 768px) {
        .container {
            padding: 0.5rem;
        }

        .step-card {
            padding: 1rem;
            margin-bottom: 1.5rem;
        }

        h1 {
            font-size: 1.6rem !important;
        }

        /* Giant Touch Targets for Mobile */
        .input-field,
        .btn,
        select {
            min-height: 60px !important;
            /* Very tall for fingers */
            font-size: 1.1rem !important;
        }

        label {
            font-size: 1.1rem;
            margin-bottom: 0.6rem;
            color: var(--text-main);
            font-weight: 600;
        }

        .pages-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 0.8rem;
        }
    }

    /* Floating Action Button for Mobile Generate */
    .floating-action {
        position: sticky;
        bottom: 20px;
        z-index: 50;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }

    /* Upload Progress Bar */
    .progress-bar-bg {
        width: 100%;
        height: 10px;
        background-color: #e2e8f0;
        border-radius: 5px;
        overflow: hidden;
        position: relative;
    }

    .progress-bar-fill {
        height: 100%;
        background-color: var(--primary);
        width: 0%;
        transition: width 0.3s ease;
        border-radius: 5px;
    }