:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1.6;
    overflow-x: hidden;
}

#glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 40px 20px;
}

header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 0.8s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.logo svg {
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

h1 {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.drop-zone {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 2px dashed var(--glass-border);
    border-radius: 24px;
    padding: 80px 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    animation: scaleIn 0.6s ease-out;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.drop-zone-content svg {
    width: 64px;
    height: 64px;
    color: var(--primary);
    margin-bottom: 24px;
    opacity: 0.8;
}

.drop-zone h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.drop-zone p {
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

.processing-view {
    animation: fadeIn 0.5s ease-out;
}

.stats-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    background: var(--bg-card);
    padding: 15px 30px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.selection-controls {
    display: flex;
    gap: 15px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-text:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-hover);
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat .label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat .value {
    font-weight: 600;
    color: var(--primary);
}

.progress-container {
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.preview-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    position: relative;
    aspect-ratio: 16/9;
    cursor: pointer;
}

.preview-card:hover {
    transform: scale(1.02);
    border-color: var(--primary);
}

.preview-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.page-checkbox-container {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
}

.page-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--primary);
}

.preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-card .page-num {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.settings-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 30px;
    background: var(--bg-card);
    padding: 20px 30px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    align-items: center;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-inputs input {
    width: 60px;
    height: 40px;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #1e293b;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
}

.range-inputs input:focus {
    outline: none;
    border-color: var(--primary);
    background: #334155;
}

.range-inputs small {
    color: var(--text-muted);
    margin-left: 5px;
}

/* Switch styling */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-card .page-num {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    backdrop-filter: blur(4px);
}

.actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn.primary {
    background: var(--primary);
    color: white;
}

.btn.primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

footer {
    text-align: center;
    margin-top: 60px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.btn-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
}