:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg: #F3F4F6;
    --card-bg: #FFFFFF;
    --text: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    padding: 16px;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 600px;
}

.header {
    text-align: center;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 4px;
}

.header p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.file-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.file-name-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-primary:disabled {
    background-color: #A5B4FC;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #EEF2FF;
    color: var(--primary);
    border: 1px dashed var(--primary);
}

#image-preview-container {
    margin-bottom: 16px;
    text-align: center;
}

#image-preview {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Loading Spinner */
.loading-container {
    text-align: center;
    padding: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

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

/* Table */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.badge {
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: bold;
    background-color: #E0E7FF;
    color: var(--primary);
}

.table-responsive {
    overflow-x: auto;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: right;
}

.items-table th, .items-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
}

.items-table th {
    background-color: #F9FAFB;
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.lang-dropdown {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background-color: var(--card-bg);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}

[dir="rtl"] .items-table {
    text-align: right;
}

[dir="ltr"] .items-table {
    text-align: left;
}