:root {
    --bg-dark: #0b0f19;
    --card-bg: rgba(22, 28, 45, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --secondary: #3b82f6;
    --accent: #10b981;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --danger: #ef4444;
    --radius-lg: 16px;
    --radius-md: 10px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

/* Background glowing circles */
.background-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(59, 130, 246, 0.05) 50%, transparent 70%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 900px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.logo i {
    color: var(--primary);
    font-size: 1.8rem;
}

.logo small {
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-badges {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.badge-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    transition: var(--transition);
}

.badge-link:hover {
    color: #fff;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

.badge-tag {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-weight: 500;
}

/* Main Card Glassmorphism */
.main-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Dropzone */
.drop-zone {
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-radius: var(--radius-md);
    padding: 3rem 1.5rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.4);
    cursor: pointer;
    transition: var(--transition);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.icon-circle {
    width: 64px;
    height: 64px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    font-size: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    transition: var(--transition);
}

.drop-zone:hover .icon-circle {
    transform: scale(1.1);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 20px var(--primary-glow);
}

.drop-zone h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.drop-zone p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* File Info Card */
.file-info-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-top: 1rem;
    animation: fadeIn 0.3s ease-in-out;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pdf-file-icon {
    font-size: 2rem;
    color: #ef4444;
}

.file-text h4 {
    font-size: 1rem;
    font-weight: 600;
}

.file-text span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 50%;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

/* Settings Section */
.settings-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item.full-width {
    grid-column: span 2;
}

.setting-item label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.select-wrapper {
    position: relative;
}

select, input[type="text"] {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    appearance: none;
}

select:focus, input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.select-wrapper i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.8rem;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.help-text code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 5px;
    border-radius: 4px;
    color: #e2e8f0;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-lg {
    flex: 1;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Loading Overlay */
.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Preview Gallery */
.preview-section {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
}

.preview-header {
    margin-bottom: 1.25rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.gallery-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.gallery-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.gallery-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 130%; /* Aspect ratio box */
    overflow: hidden;
    background: #000;
    cursor: pointer;
}

.gallery-img-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: var(--transition);
}

.gallery-card:hover img {
    transform: scale(1.05);
}

.gallery-card-info {
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.5);
    font-size: 0.85rem;
}

.gallery-card-info span {
    font-weight: 500;
}

.gallery-card-info a {
    color: var(--primary);
    text-decoration: none;
}

.gallery-card-info a:hover {
    text-decoration: underline;
}

/* Upload Progress Bar */
.upload-progress-container {
    margin-top: 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    animation: fadeIn 0.3s ease-in-out;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--secondary), var(--primary), var(--accent));
    background-size: 200% 100%;
    border-radius: 4px;
    transition: width 0.2s ease;
    animation: gradientShift 2s linear infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Skeleton Loading for Lazy Images */
.gallery-img-wrapper.loading {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.6) 25%, rgba(51, 65, 85, 0.6) 50%, rgba(30, 41, 59, 0.6) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Preview Actions Bar */
.preview-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    color: #c7d2fe;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Footer */
.app-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90%;
    max-height: 80vh;
    border-radius: var(--radius-md);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.modal-caption {
    margin-top: 1rem;
    color: #fff;
    font-size: 1rem;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

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

@media (max-width: 640px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .setting-item.full-width {
        grid-column: span 1;
    }
    .action-buttons {
        flex-direction: column;
    }
}
