:root {
    --bg-color: #08090e;
    --panel-bg: rgba(20, 24, 38, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --accent-color: #7b2cbf;
    --accent-glow: rgba(123, 44, 191, 0.4);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --success-color: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(123, 44, 191, 0.08) 0%, transparent 40%);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    padding: 2rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}

.logo-container {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.logo-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--accent-color);
    filter: blur(15px);
    opacity: 0.3;
    z-index: -1;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #a78bfa, #f43f5e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.3);
    color: #c084fc;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.app-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #ffffff, #d1d5db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header .subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    font-weight: 300;
}

/* Workspace Grid */
.workspace {
    display: grid;
    grid-template-columns: 1fr 1fr 1.1fr;
    gap: 1.5rem;
    align-items: stretch;
}

@media (max-width: 1024px) {
    .workspace {
        grid-template-columns: 1fr;
    }
}

/* Panels */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.panel:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.panel-header .icon {
    font-size: 1.5rem;
}

.panel-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #f3f4f6;
}

/* Presets & Chat editor */
.presets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-preset {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-preset:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-preset.active {
    background: rgba(123, 44, 191, 0.15);
    border-color: rgba(123, 44, 191, 0.5);
    color: #e9d5ff;
    box-shadow: 0 0 10px rgba(123, 44, 191, 0.1);
}

.chat-editor-container {
    flex-grow: 1;
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

#chatInput {
    flex-grow: 1;
    width: 100%;
    min-height: 250px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

#chatInput:focus {
    border-color: rgba(123, 44, 191, 0.6);
    box-shadow: 0 0 0 2px rgba(123, 44, 191, 0.15);
}

/* Primary Button */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-color) 0%, #6366f1 100%);
    border: none;
    color: white;
    padding: 0.9rem 1.2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(123, 44, 191, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Empty States */
.empty-state {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
    padding: 3rem 1rem;
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.scanning-glow {
    position: absolute;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(123, 44, 191, 0.15) 0%, transparent 70%);
    animation: pulseGlow 3s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 1; }
}

/* Progress Steps */
.status-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: 8px;
    transition: all 0.3s;
}

.step .bullet {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.step.active {
    color: var(--text-primary);
    background: rgba(123, 44, 191, 0.08);
    border-color: rgba(123, 44, 191, 0.2);
}

.step.active .bullet {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 10px var(--accent-glow);
    animation: bounce 1s infinite alternate;
}

.step.completed {
    color: #34d399;
}

.step.completed .bullet {
    background: var(--success-color);
    color: white;
    box-shadow: 0 0 10px var(--success-glow);
}

@keyframes bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-3px); }
}

/* Extracted Cards */
.extracted-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.extracted-card h3, .extracted-items-container h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.info-row .value {
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    max-width: 70%;
}

/* Items List */
.extracted-items-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.items-list {
    list-style: none;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.item-row:not(:last-child) {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.item-row .qty {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* GHN Label */
.ghn-label {
    background: white;
    color: #111827;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    font-family: system-ui, -apple-system, sans-serif;
    position: relative;
    overflow: hidden;
}

.ghn-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.ghn-brand {
    font-weight: 800;
    font-size: 1.1rem;
    color: #ea580c;
    letter-spacing: -0.025em;
    text-transform: uppercase;
}

.ghn-service {
    font-size: 0.7rem;
    font-weight: 600;
    background: #ffedd5;
    color: #ea580c;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.ghn-barcode-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border: 1px solid #e5e7eb;
}

.barcode-stripes {
    height: 40px;
    width: 90%;
    background: linear-gradient(90deg, 
        #000 0%, #000 3%, transparent 3%, transparent 5%, 
        #000 5%, #000 9%, transparent 9%, transparent 10%, 
        #000 10%, #000 11%, transparent 11%, transparent 15%,
        #000 15%, #000 20%, transparent 20%, transparent 22%,
        #000 22%, #000 23%, transparent 23%, transparent 27%,
        #000 27%, #000 32%, transparent 32%, transparent 35%,
        #000 35%, #000 36%, transparent 36%, transparent 40%,
        #000 40%, #000 42%, transparent 42%, transparent 45%,
        #000 45%, #000 49%, transparent 49%, transparent 50%,
        #000 50%, #000 52%, transparent 52%, transparent 56%,
        #000 56%, #000 58%, transparent 58%, transparent 62%,
        #000 62%, #000 65%, transparent 65%, transparent 67%,
        #000 67%, #000 70%, transparent 70%, transparent 72%,
        #000 72%, #000 75%, transparent 75%, transparent 77%,
        #000 77%, #000 82%, transparent 82%, transparent 84%,
        #000 84%, #000 88%, transparent 88%, transparent 90%,
        #000 90%, #000 95%, transparent 95%, transparent 100%
    );
}

.barcode-number {
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 0.25rem;
    letter-spacing: 0.05em;
}

.ghn-addresses {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 0.75rem;
}

.addr-box strong {
    color: #4b5563;
    display: block;
    margin-bottom: 0.1rem;
}

.addr-box p {
    color: #111827;
    font-weight: 500;
}

.ghn-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.ghn-footer .lbl {
    color: #6b7280;
    display: block;
}

.ghn-footer .val {
    font-weight: 600;
    color: #111827;
}

/* Invoice receipt */
.invoice-receipt {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.invoice-receipt h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 0.5rem;
}

.invoice-body {
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.divider {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: 1rem 0;
}

.sub-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin: 0.5rem 0;
}

.invoice-totals {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.total-row.grand-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f3f4f6;
}

.total-row.grand-total span:last-child {
    color: #34d399;
}

/* Loading animations */
.hidden {
    display: none !important;
}

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Fade In animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-content, .shipping-content {
    animation: fadeIn 0.4s ease forwards;
}

/* Draft Order Preview Table */
.draft-preview-container {
    background: rgba(245, 158, 11, 0.03);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    margin-top: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    text-align: left;
}

.draft-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #f59e0b;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.draft-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
}

.draft-table th {
    color: var(--text-secondary);
    text-align: left;
    padding: 0.5rem 0.25rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.draft-table td {
    padding: 0.6rem 0.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.draft-table td.number, .draft-table th.number {
    text-align: right;
}

.draft-customer-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.draft-customer-card h4 {
    color: #d1d5db;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.draft-customer-card p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.draft-totals {
    border-top: 1px solid rgba(245, 158, 11, 0.2);
    padding-top: 0.75rem;
    font-size: 0.9rem;
}

.draft-totals .row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.draft-totals .row.grand-total {
    font-weight: 700;
    color: #f59e0b;
    font-size: 1.05rem;
    margin-top: 0.5rem;
}

/* Styled Markdown Table in Chat */
.chat-markdown-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.chat-markdown-table th {
    background: rgba(123, 44, 191, 0.15);
    color: #a78bfa;
    padding: 8px 12px;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid rgba(123, 44, 191, 0.3);
}
.chat-markdown-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #f3f4f6;
}
.chat-markdown-table tr:last-child td {
    border-bottom: none;
}
