/* Edeka-Tool Styles */
:root {
    --primary: #1b6d2f;
    --primary-light: #238c3d;
    --primary-dark: #145223;
    --primary-bg: #f0f8f2;
    --danger: #c0392b;
    --warning: #e67e22;
    --success: #27ae60;
    --bg: #eef1f5;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-light: #6b7280;
    --border: #e0e4ea;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 560px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container.wide {
    max-width: 1200px;
}

/* Hero Card */
.hero-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    flex: 1;
}

.logo-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.logo-icon {
    width: 52px;
    height: 52px;
    background: var(--primary);
    color: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

h1 {
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-light);
    font-size: 0.82rem;
    margin-top: 0.1rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text);
}

.input-kw {
    width: 90px;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    text-align: center;
    font-weight: 600;
    transition: border-color 0.2s;
    background: var(--bg);
}

.input-kw:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    background: var(--bg);
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.upload-area.has-file {
    border-style: solid;
    border-color: var(--primary);
    background: var(--primary-bg);
    padding: 1rem;
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.upload-icon-wrapper {
    margin-bottom: 0.75rem;
    color: var(--primary);
    opacity: 0.7;
}

.upload-text {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.upload-hint {
    font-size: 0.82rem;
    color: var(--text-light);
}

.upload-formats {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 0.75rem;
    opacity: 0.7;
}

.upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.upload-preview img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.upload-preview p {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.btn-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    border: 2px solid white;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s;
}

.btn-remove:hover {
    transform: scale(1.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    padding: 0.85rem;
    font-size: 0.95rem;
    margin-top: 0.5rem;
    box-shadow: 0 2px 8px rgba(27, 109, 47, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(27, 109, 47, 0.35);
    transform: translateY(-1px);
}

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

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

.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover { background: var(--bg); }

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: -2px;
}

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

/* Footer */
.app-footer {
    text-align: center;
    padding: 1.25rem;
    font-size: 0.75rem;
    color: var(--text-light);
    opacity: 0.6;
}

/* Preview Table */
.table-wrapper {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.preview-table th {
    background: var(--primary);
    color: white;
    padding: 0.7rem 0.5rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.preview-table td {
    padding: 0.45rem 0.4rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.preview-table tr:hover { background: #f8faf9; }

.preview-table tr.unmatched {
    background: #fef2f2;
}

.preview-table tr.unmatched:hover { background: #fee2e2; }

.preview-table tr.low-confidence {
    background: #fffbeb;
}

.col-skip { width: 40px; text-align: center; }
.col-article { min-width: 180px; }
.col-match { min-width: 200px; }
.col-price { width: 80px; }
.col-tax { width: 65px; }
.col-branch { width: 55px; text-align: center; }

.receipt-name {
    cursor: help;
    font-size: 0.85rem;
}

.qty-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    font-size: 0.68rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.3rem;
    font-weight: 600;
}

.confidence {
    display: inline-block;
    font-size: 0.68rem;
    color: var(--text-light);
    margin-left: 0.25rem;
}

.match-select {
    width: 100%;
    padding: 0.35rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    background: white;
    transition: border-color 0.2s;
}

.match-select:focus {
    outline: none;
    border-color: var(--primary);
}

.input-price {
    width: 70px;
    padding: 0.35rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    text-align: right;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.input-price:focus {
    outline: none;
    border-color: var(--primary);
}

.input-tax {
    width: 60px;
    padding: 0.35rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    transition: border-color 0.2s;
}

.input-tax:focus {
    outline: none;
    border-color: var(--primary);
}

.input-qty {
    width: 45px;
    padding: 0.35rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    text-align: center;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.input-qty:focus {
    outline: none;
    border-color: var(--primary);
}

.form-actions {
    margin-top: 1.5rem;
    text-align: center;
}

/* Raw Text */
.raw-text {
    background: #1a1a2e;
    color: #e0e0e0;
    border-radius: var(--radius);
    padding: 1.25rem;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 0.82rem;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 1rem 0;
    max-height: 600px;
    overflow-y: auto;
    line-height: 1.7;
}

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 0.75rem; }
    .hero-card { padding: 1.25rem; border-radius: 12px; }
    header { flex-direction: column; align-items: flex-start; }
    .preview-table { font-size: 0.75rem; }
    .input-qty { width: 38px; }
    .col-article { min-width: 120px; }
    .logo-row { gap: 0.75rem; }
    .logo-icon { width: 44px; height: 44px; border-radius: 11px; }
    .logo-icon svg { width: 26px; height: 26px; }
    h1 { font-size: 1.1rem; }
}
