:root {
    --primary-color: #007bff;
    --primary-color-dark: #0056b3;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #212529;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --error-color: #dc3545;
    --font-family: 'Inter', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 2rem;
    background-color: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.app-header {
    padding: 2rem;
    background-color: var(--primary-color);
    color: var(--surface-color);
    text-align: center;
}

.app-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.app-header p {
    margin: 0.5rem 0 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

.app-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

.input-column, .output-column {
    padding: 1rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.input-group input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

#image-input {
    display: none;
}

.file-upload-label {
    background-color: var(--secondary-color);
    color: var(--surface-color);
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
    display: block;
    text-align: center;
}

.file-upload-label:hover {
    background-color: #5a6268;
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.image-preview img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border-color);
}

#extract-button {
    background: var(--primary-color);
    color: var(--surface-color);
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    width: 100%;
    display: none; /* Hidden by default */
}

#extract-button:hover {
    background: var(--primary-color-dark);
    transform: translateY(-2px);
}

#extract-button:disabled {
    background: #e4e6eb;
    color: #a0a0a0;
    cursor: not-allowed;
    transform: none;
}

#output {
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    background: var(--surface-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

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

th {
    background: var(--background-color);
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

.suggestions {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 8px;
}

.suggestions h3 {
    margin-top: 0;
    color: #856404;
}

.suggestions ul {
    padding-left: 1.5rem;
    margin: 0;
}

.loader {
    border: 4px solid var(--background-color);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

.app-footer {
    padding: 1rem;
    background-color: var(--background-color);
    text-align: center;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

@media (max-width: 768px) {
    .app-main {
        grid-template-columns: 1fr;
    }
}