@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Source+Sans+Pro:wght@400;600&display=swap');

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

:root {
    --primary: #0170B9;
    --primary-light: #2992d6;
    --primary-dark: #0d1361;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #d1d5db;
    --gray-500: #4B4F58;
    --gray-900: #3a3a3a;
}

body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    min-height: 100vh;
    padding: 20px;
    font-size: 17px;
    line-height: 1.7;
    color: var(--gray-500);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

header {
    background: white;
    padding: 20px 24px;
    text-align: center;
    border-bottom: 3px solid var(--primary);
}

header .logo {
    max-height: 60px;
    margin-bottom: 12px;
}

header h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

header p {
    color: var(--gray-500);
    font-size: 0.95rem;
}

.alert {
    background: #fef3c7;
    color: #92400e;
    padding: 12px 20px;
    margin: 20px;
    border-radius: 8px;
}

/* Dictation */
.dictation { padding: 24px; }

.buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary-dark); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--primary-dark); color: white; }
.btn-success:hover:not(:disabled) { background: var(--primary); }
.btn-secondary { background: var(--gray-200); color: var(--gray-900); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-300); }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; text-decoration: underline; padding: 0; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.2rem; opacity: 0.6; }
.btn-icon:hover { opacity: 1; }

.status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: 8px;
    margin-bottom: 16px;
}

.status .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-300);
}

.status.listening .dot {
    background: var(--danger);
    animation: pulse 1s infinite;
}

.status.ready .dot { background: var(--success); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.transcript-box {
    background: var(--gray-100);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.transcript-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-500);
}

.transcript {
    min-height: 80px;
    background: white;
    border-radius: 6px;
    padding: 12px;
    font-size: 1.1rem;
}

.transcript .interim { color: var(--gray-500); font-style: italic; }

.actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.tips {
    background: #e8f4fc;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--primary-dark);
    border-left: 4px solid var(--primary);
}

/* Loading */
.loading {
    padding: 60px;
    text-align: center;
}

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

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

/* Results */
.results { padding: 24px; background: var(--gray-100); }
.results h2 {
    margin-bottom: 16px;
    font-family: 'Montserrat', sans-serif;
    color: var(--gray-900);
}

.summary {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.stat {
    flex: 1;
    background: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.stat.ok { color: var(--success); }
.stat.warn { color: var(--warning); }

table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

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

th {
    background: var(--primary-dark);
    color: white;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-family: 'Montserrat', sans-serif;
}

tr.matched { background: #ecfdf5; }
tr.multiple { background: #fffbeb; }
tr.unmatched { background: #fef2f2; }

.product-info strong { display: block; }
.product-info small { color: var(--gray-500); }

.product-multiple span { color: var(--warning); }
.product-not-found span { color: var(--danger); }

.qty-input {
    width: 80px;
    padding: 8px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    text-align: center;
}

.final-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.export-preview {
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    padding: 16px;
}

.export-preview pre {
    background: var(--gray-900);
    color: #10b981;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.9rem;
    margin: 12px 0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.modal-close {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-body { padding: 20px; }

.options-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.option, .search-result {
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 8px;
    background: var(--gray-100);
}

.option:hover, .search-result:hover { background: #e8f4fc; }

.option strong, .search-result strong { display: block; }
.option small, .search-result small { color: var(--gray-500); font-size: 0.85rem; }

.manual-search input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 12px;
}

.manual-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(1, 112, 185, 0.1);
}

#manualResults {
    max-height: 200px;
    overflow-y: auto;
}

.no-options, .no-results {
    color: var(--gray-500);
    text-align: center;
    padding: 20px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    background: var(--gray-900);
    color: white;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* Responsive */
@media (max-width: 600px) {
    .buttons { flex-direction: column; }
    .summary { flex-direction: column; }
    .final-actions { flex-direction: column; }
    th, td { padding: 8px; font-size: 0.9rem; }
}
