:root {
    --primary: #000000;
    --accent: #2563eb;
    --bg-gradient: linear-gradient(135deg, #f0f4ff 0%, #e0eaff 100%);
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.5);
    --text: #1f2937;
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-gradient);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.container {
    width: 100%;
    max-width: 640px;
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
}

/* Gemini Processing Effect */
.container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #2563eb, #9333ea, #db2777, #2563eb);
    background-size: 400%;
    z-index: -1;
    border-radius: 26px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.processing .container::before {
    opacity: 1;
    animation: glowing 20s linear infinite;
}

@keyframes glowing {
    0% {
        background-position: 0 0;
    }

    50% {
        background-position: 400% 0;
    }

    100% {
        background-position: 0 0;
    }
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

p {
    color: #6b7280;
    font-size: 0.95rem;
}

.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.4);
    margin-bottom: 2rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background-color: rgba(37, 99, 235, 0.05);
    transform: translateY(-2px);
}

.icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

#fileName {
    font-weight: 500;
    color: var(--primary);
}

.bg-selection h3 {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.05em;
}

.bg-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.bg-option {
    position: relative;
}

/* For Tooltip Positioning */
.bg-option input {
    display: none;
}

.bg-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 0.85rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.bg-option input:checked~.bg-card {
    border-color: var(--accent);
    background-color: #eff6ff;
    color: var(--accent);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.bg-card small {
    display: block;
    font-size: 0.65rem;
    color: #9ca3af;
    margin-top: 6px;
    font-weight: 400;
}

/* Tooltip / Preview Bubble */
.preview-bubble {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    width: 140px;
    height: 140px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.2);
    padding: 6px;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-bubble::after {
    /* Arrow */
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.preview-bubble img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.bg-option:hover .preview-bubble {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    bottom: 125%;
}

button {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Log Window */
#logWindow {
    margin-top: 1.5rem;
    background: #0f172a;
    color: #38bdf8;
    padding: 1rem;
    border-radius: 12px;
    font-family: 'Menlo', 'Monaco', monospace;
    font-size: 0.8rem;
    max-height: 200px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
    display: none;
    /* Hidden initially */
}

#logWindow.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.log-line {
    margin-bottom: 4px;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: #9ca3af;
}