:root {
    --primary: #4ade80;
    --primary-hover: #22c55e;
    --secondary: #2563eb;
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.6);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding: 2rem;
}

/* Background Animated Shapes */
.background-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    opacity: 0.5;
}

.shape-1 {
    width: 600px;
    height: 600px;
    background: var(--primary);
    top: -200px;
    left: -200px;
    animation: drift 25s infinite alternate ease-in-out;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    right: -150px;
    animation: drift 20s infinite alternate-reverse ease-in-out;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 100px) scale(1.1); }
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

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

header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

header h1 span {
    background: linear-gradient(135deg, var(--primary), #86efac);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Glassmorphism Classes */
.card, .drop-zone {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    border: 2px dashed rgba(74, 222, 128, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.drop-zone:hover, .drop-zone.dragover {
    background: rgba(74, 222, 128, 0.05);
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 30px 60px -12px rgba(74, 222, 128, 0.1);
}

.drop-zone .icon {
    color: var(--primary);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.drop-zone:hover .icon {
    transform: translateY(-5px) scale(1.1);
}

.drop-zone h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.drop-zone p {
    color: var(--text-muted);
}

/* CSS Loader Spinner */
.loader-container {
    text-align: center;
    margin: 3rem 0;
    animation: fadeIn 0.4s ease;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-bottom-color: var(--secondary);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Area */
.results-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.card h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.data-grid {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.data-item {
    display: flex;
    flex-direction: column;
}

.data-item .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
}

.data-item input {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    padding: 1.2rem;
    border-radius: 12px;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.data-item input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.1);
}

.image-preview {
    display: flex;
    flex-direction: column;
}

.img-wrapper {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.image-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    max-height: 400px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Raw OCR Output */
.raw-text-section {
    margin-top: 2rem;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.raw-text-section textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    padding: 1.2rem;
    border-radius: 12px;
    color: var(--text-muted);
    font-family: monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s ease;
}

.raw-text-section textarea:focus {
    border-color: var(--secondary);
}

/* Table Section */
.table-section {
    margin-top: 2rem;
    animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.3);
}

#items-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

#items-table th, #items-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

#items-table th {
    background: rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
}

#items-table tbody tr {
    transition: background 0.3s ease;
}

#items-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Actions Section */
.actions-section {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-color);
    text-align: right;
    border-radius: 0 0 20px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #0f172a;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-shadow: 0 10px 15px -3px rgba(74, 222, 128, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -3px rgba(74, 222, 128, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #475569;
    box-shadow: none;
    cursor: not-allowed;
    color: #cbd5e1;
}

/* Responsive adjustements */
@media (max-width: 800px) {
    .results-section {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
}
