:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(26, 26, 46, 0.6);
    --bg-card-hover: rgba(26, 26, 46, 0.8);
    
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-muted: #6b6b8c;
    
    --border-color: rgba(102, 126, 234, 0.2);
    --border-hover: rgba(102, 126, 234, 0.4);
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%);
    background-attachment: fixed;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo svg {
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.5));
    animation: float 3s ease-in-out infinite;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
}

.upload-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    animation: fadeInUp 0.6s ease;
}

.upload-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.upload-area {
    text-align: center;
    padding: 3rem 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--border-hover);
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-2px);
}

.upload-area.drag-over {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    color: #667eea;
    margin-bottom: 1.5rem;
    animation: bounce 2s ease-in-out infinite;
}

.upload-area h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.file-types {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem !important;
}

.browse-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.browse-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

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

/* Preview Area */
.preview-area {
    animation: fadeIn 0.4s ease;
}

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

.preview-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.remove-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
}

.image-preview {
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-md);
}

.image-preview img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    display: block;
}

.process-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    background: var(--gradient-accent);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.process-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 172, 254, 0.4);
}

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

/* Processing Area */
.processing-area {
    text-align: center;
    padding: 3rem 2rem;
    animation: fadeIn 0.4s ease;
}

.spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

.processing-area h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.processing-area p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Results Section */
.results-section {
    animation: fadeInUp 0.6s ease;
}

.results-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.results-header h2 {
    font-size: 1.75rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.new-scan-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.new-scan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Store Info */
.store-info {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.store-info h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.info-item {
    display: flex;
    gap: 1rem;
}

.info-item .label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 120px;
}

.info-item .value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.125rem;
}

/* Items Section */
.items-section {
    margin-bottom: 2rem;
}

.items-section h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.items-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(26, 26, 46, 0.4);
}

.items-table thead {
    background: rgba(102, 126, 234, 0.1);
}

.items-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.items-table th:last-child,
.items-table td:last-child {
    text-align: right;
}

.items-table tbody tr {
    transition: background var(--transition-fast);
}

.items-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.items-table td {
    padding: 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.items-table tbody tr:last-child td {
    border-bottom: none;
}

/* Totals Section */
.totals-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(79, 172, 254, 0.05);
    border: 1px solid rgba(79, 172, 254, 0.2);
    border-radius: 12px;
}

.totals-grid {
    display: grid;
    gap: 1rem;
}

.total-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}

.total-item .label {
    color: var(--text-secondary);
    font-weight: 500;
}

.total-item .value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.125rem;
}

.total-item.grand-total {
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
    margin-top: 0.5rem;
}

.total-item.grand-total .label {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.total-item.grand-total .value {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.total-item .value.discount {
    color: var(--success);
}

/* Raw Text Section */
.raw-text-section {
    margin-top: 2rem;
}

.raw-text-section details {
    background: rgba(26, 26, 46, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.raw-text-section summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    user-select: none;
}

.raw-text-section summary:hover {
    background: rgba(102, 126, 234, 0.05);
    color: var(--text-primary);
}

.raw-text-section pre {
    padding: 1.5rem;
    margin: 0;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    background: rgba(15, 15, 35, 0.6);
    border-top: 1px solid var(--border-color);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

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

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .upload-card {
        padding: 2rem 1.5rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .results-card {
        padding: 1.5rem;
    }

    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .items-table th,
    .items-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }

    .total-item .value {
        font-size: 1rem;
    }

    .total-item.grand-total .value {
        font-size: 1.25rem;
    }
}
