:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #a855f7;
    --bg-dark: #0f172a;
    --text-light: #f8fafc;
    --text-dim: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 2rem 1rem;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite alternate;
}

.blob-1 {
    width: 300px;
    height: 300px;
    background: var(--primary);
    top: -50px;
    left: -50px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 200px;
    height: 200px;
    background: #ec4899;
    top: 40%;
    left: 40%;
    opacity: 0.4;
    animation-duration: 15s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -30px) scale(1.1); }
}

/* Layout */
.container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 10;
}

/* Header */
header {
    text-align: center;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1.1rem;
}

/* Glass Card Utility */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Upload Area */
.upload-area {
    text-align: center;
    cursor: pointer;
    border: 2px dashed var(--glass-border);
}

.upload-area:hover, .upload-area.drag-over {
    background: rgba(46, 55, 76, 0.8);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.icon-container {
    width: 64px;
    height: 64px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--primary);
    font-size: 1.8rem;
}

.upload-area h3 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.upload-area p {
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.upload-area span {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.support-text {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Image Wrappers */
.image-wrapper {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    background: #000;
}

.image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

/* Loader */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    gap: 1rem;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Result Section */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Extracted Data */
.extracted-data-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
}

.extracted-data-container h4 {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.5rem;
}

.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: left;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.data-item.full-width {
    grid-column: span 2;
}

.data-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    word-break: break-word;
}

.result-header h3 {
    color: #4ade80; /* Green for success */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.close-btn {
    background: transparent;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.close-btn:hover {
    color: #fff;
}

/* Footer & Toast */
footer {
    margin-top: auto;
    color: var(--text-dim);
    font-size: 0.9rem;
    opacity: 0.6;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    z-index: 100;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.hidden {
    display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .container {
        width: 100%;
    }
    .logo {
        font-size: 2rem;
    }
}
