:root {
    --primary-color: #4f46e5;
    /* Indigo-600 */
    --primary-hover: #4338ca;
    /* Indigo-700 */
    --secondary-color: #db2777;
    /* Pink-600 */
    --bg-dark: #f1f5f9;
    /* Slate-100 (Light Background) */
    --glass-bg: rgba(255, 255, 255, 0.85);
    /* High opacity white for glass */
    --glass-border: rgba(0, 0, 0, 0.06);
    /* Subtle dark border */
    --text-main: #0f172a;
    /* Slate-900 */
    --text-muted: #64748b;
    /* Slate-500 */
    --font-family: 'Outfit', sans-serif;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --shadow-main: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Specific light mode overrides */
    --element-bg: rgba(255, 255, 255, 0.6);
    --element-bg-hover: rgba(255, 255, 255, 0.9);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 20px;
}

/* Background Animation */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    /* Slightly lower opacity for light mode */
    animation: move 20s infinite alternate;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: #818cf8;
    /* Light Indigo */
    top: -100px;
    left: -100px;
    animation-duration: 25s;
}

.globe-2 {
    width: 300px;
    height: 300px;
    background: #f472b6;
    /* Light Pink */
    bottom: -50px;
    right: -50px;
    animation-duration: 18s;
}

.globe-3 {
    width: 250px;
    height: 250px;
    background: #22d3ee;
    /* Cyan */
    top: 40%;
    left: 40%;
    animation-duration: 30s;
    opacity: 0.3;
}

@keyframes move {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, -50px) scale(1.1);
    }
}

/* App Container */
.app-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid white;
    /* Hard white border looks clean in light mode */
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-main);
    width: 100%;
    max-width: 800px;
    padding: 40px;
    position: relative;
    z-index: 10;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo i {
    font-size: 2.5rem;
    color: var(--primary-color);
    background: -webkit-linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    /* Dark gradient for light mode text */
    background: -webkit-linear-gradient(45deg, #1e293b, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed #cbd5e1;
    /* Slate-300 */
    border-radius: var(--radius-md);
    background: var(--element-bg);
    padding: 60px 20px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-color);
    background: #e0e7ff;
    /* Light indigo tint */
}

.upload-icon {
    font-size: 3rem;
    color: #94a3b8;
    /* Slate-400 */
    margin-bottom: 20px;
    transition: var(--transition);
}

.drop-zone:hover .upload-icon {
    color: var(--primary-color);
    transform: translateY(-5px);
}

.drop-content h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
}

.drop-content p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-text {
    cursor: pointer;
    font-family: var(--font-family);
    border: none;
    outline: none;
    transition: var(--transition);
}

.btn-secondary {
    padding: 12px 30px;
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-main);
    font-weight: 500;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-2px);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn-text {
    background: transparent;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-text:hover {
    text-decoration: underline;
}

/* Preview Area */
.preview-area {
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.image-card {
    background: white;
    border-radius: var(--radius-sm);
    padding: 8px;
    position: relative;
    border: 1px solid #e2e8f0;
    transition: var(--transition);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.image-card:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.image-card img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    object-fit: cover;
}

.remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    opacity: 0;
    transform: scale(0.8);
}

.image-card:hover .remove-btn {
    opacity: 1;
    transform: scale(1);
}

.remove-btn:hover {
    background: #be185d;
}

/* Utilities */
.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .app-container {
        padding: 25px;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .drop-zone {
        padding: 40px 15px;
    }
}

/* Nav */
.app-nav {
    position: fixed;
    top: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid #e2e8f0;
    display: flex;
    gap: 20px;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-main);
}

.nav-link.active {
    color: var(--primary-color);
}

/* Radio Group */
.radio-group {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.radio-group label {
    cursor: pointer;
    background: white;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid #e2e8f0;
    transition: var(--transition);
    color: var(--text-main);
}

.radio-group label:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.radio-group input {
    margin-right: 8px;
}

/* PDF Page Card */
.file-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.download-single-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.image-card:hover .download-single-btn {
    opacity: 1;
}

.image-card:hover .download-single-btn:hover {
    background: var(--primary-hover);
}

/* Word Preview Container */
.doc-preview-box {
    background: white;
    padding: 40px;
    border: 1px solid #e2e8f0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
}

/* Ensure the docx-preview rendering looks okay constraints */
.docx_preview {
    width: 100% !important;
}

.docx_preview section {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    margin-bottom: 20px !important;
}

/* Fix for Lists (Bullets & Numbering) disappearing due to global reset */
.docx_preview ul,
.docx_preview ol {
    padding-left: 40px !important;
    /* Restore default padding for lists */
    margin-bottom: 16px !important;
}

.docx_preview li {
    margin-bottom: 4px;
}

/* Fix for Text/Font matching Input File */
/* The global * { font-family } was overriding the doc rendering. */
.docx_preview,
.docx_preview * {
    font-family: initial !important;
    /* Let docx-preview control the fonts */
    line-height: normal !important;
    /* Reset line height to doc defaults */
}

/* Printing Mode Overrides */
.printing-mode {
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: white !important;
}

.printing-mode .docx_preview section {
    box-shadow: none !important;
    margin: 0 !important;
    border: none !important;
    page-break-after: always;
    /* Ensure proper pagination */
    break-after: page;
}