/* ============================================================
   easybill Verstehen – Design System
   Font: System Stack (wie easybill.de)
   Primary: #0066FF  Purple: #7C3AED  Green: #059669
   ============================================================ */

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

:root {
    --blue:   #0066FF;
    --blue-light: #EFF6FF;
    --blue-dark:  #0052CC;
    --purple: #7C3AED;
    --purple-light: #F5F3FF;
    --green:  #059669;
    --green-light: #ECFDF5;
    --red:    #DC2626;
    --red-light: #FEF2F2;
    --gray-50:  #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-500: #6B7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --white: #FFFFFF;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow:    0 4px 16px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 40px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.05);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-900);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ── LOGIN PAGE ── */
.login-page {
    background: linear-gradient(135deg, #EFF6FF 0%, #F5F3FF 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.login-subtitle {
    color: var(--gray-500);
    margin-bottom: 28px;
    font-size: 14px;
}

.login-footer {
    color: var(--gray-500);
    font-size: 13px;
}

/* ── FORMS ── */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,102,255,.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
    border-color: var(--blue);
}
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }

.btn-outline {
    background: transparent;
    color: var(--gray-700);
    border-color: var(--gray-200);
}
.btn-outline:hover { background: var(--gray-100); }

.btn-purple {
    background: var(--purple);
    color: var(--white);
    border-color: var(--purple);
}
.btn-purple:hover { background: #6D28D9; }

.btn-green {
    background: var(--green);
    color: var(--white);
    border-color: var(--green);
}
.btn-green:hover { background: #047857; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; padding: 12px 20px; font-size: 15px; }

/* ── ALERTS ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 18px;
    border-width: 1px;
    border-style: solid;
}
.alert-error   { background: var(--red-light);    color: var(--red);    border-color: #FCA5A5; }
.alert-success { background: var(--green-light);  color: var(--green);  border-color: #6EE7B7; }
.alert-info    { background: var(--blue-light);   color: var(--blue);   border-color: #93C5FD; }

/* ── NAVBAR ── */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--gray-900);
    flex-shrink: 0;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-link {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    transition: all .15s;
}
.nav-link:hover { color: var(--gray-900); background: var(--gray-100); }
.nav-link.active { color: var(--blue); background: var(--blue-light); font-weight: 600; }

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--gray-500);
}

/* ── LAYOUT ── */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 60px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.page-header {
    margin-bottom: 32px;
}
.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}
.page-header p {
    color: var(--gray-500);
    font-size: 15px;
}

/* ── BREADCRUMB ── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 8px;
}
.breadcrumb a { color: var(--blue); }
.breadcrumb a:hover { text-decoration: underline; }

/* ── MODULE GRID (Dashboard) ── */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.module-card {
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    transition: all .2s;
    position: relative;
}
.module-card:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.module-datev:hover  { border-color: var(--blue); }
.module-api:hover    { border-color: var(--purple); }
.module-import:hover { border-color: var(--green); }

.module-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--blue-light);
}
.module-api .module-icon    { background: var(--purple-light); }
.module-import .module-icon { background: var(--green-light); }

.module-content { flex: 1; }
.module-content h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}
.module-content p {
    font-size: 14px;
    color: var(--gray-500);
    line-height: 1.55;
    margin-bottom: 14px;
}

.module-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
    padding: 3px 10px;
    background: var(--blue-light);
    color: var(--blue);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}
.tag-purple { background: var(--purple-light); color: var(--purple); }
.tag-green  { background: var(--green-light);  color: var(--green); }

.module-arrow {
    font-size: 20px;
    color: var(--gray-300);
    flex-shrink: 0;
    transition: color .15s, transform .15s;
}
.module-card:hover .module-arrow { color: var(--blue); transform: translateX(4px); }
.module-api:hover    .module-arrow { color: var(--purple); }
.module-import:hover .module-arrow { color: var(--green); }

/* ── STATS ROW ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon-blue   { background: var(--blue-light); }
.stat-icon-green  { background: var(--green-light); }
.stat-icon-purple { background: var(--purple-light); }

.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; margin-bottom: 2px; }
.stat-value { font-size: 15px; font-weight: 700; color: var(--gray-900); }

/* ── MODULE PAGES ── */
.module-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .module-layout { grid-template-columns: 1fr; }
}

.card {
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
}

.card-body {
    padding: 24px;
}

/* ── CHAT UI ── */
.chat-messages {
    min-height: 360px;
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.chat-message.user { flex-direction: row-reverse; }

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.chat-message.user .chat-avatar    { background: var(--blue);   color: var(--white); }
.chat-message.ai .chat-avatar      { background: var(--gray-200); color: var(--gray-700); }

.chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}
.chat-message.user .chat-bubble {
    background: var(--blue);
    color: var(--white);
    border-bottom-right-radius: 4px;
}
.chat-message.ai .chat-bubble {
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-900);
    border-bottom-left-radius: 4px;
}

.chat-bubble code {
    background: rgba(0,0,0,.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-size: 13px;
}

.chat-bubble pre {
    background: var(--gray-900);
    color: #E5E7EB;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', monospace;
}

.chat-input-area {
    padding: 16px 20px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    min-height: 44px;
    max-height: 120px;
    line-height: 1.5;
    transition: border-color .15s, box-shadow .15s;
}
.chat-input-area textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,102,255,.1);
}

/* ── QUICK PROMPTS ── */
.quick-prompts {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-prompt-btn {
    padding: 6px 12px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}
.quick-prompt-btn:hover {
    background: var(--blue-light);
    color: var(--blue);
    border-color: var(--blue);
}

/* ── API TOOL ── */
.api-endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.api-endpoint-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s;
    border: 1px solid transparent;
}
.api-endpoint-item:hover {
    background: var(--gray-100);
}
.api-endpoint-item.active {
    background: var(--blue-light);
    border-color: var(--blue);
}

.method-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    font-family: monospace;
    min-width: 44px;
    text-align: center;
}
.method-get    { background: #D1FAE5; color: #065F46; }
.method-post   { background: #DBEAFE; color: #1E40AF; }
.method-put    { background: #FEF3C7; color: #92400E; }
.method-delete { background: #FEE2E2; color: #991B1B; }

.endpoint-path {
    font-family: 'SF Mono', 'Monaco', monospace;
    font-size: 13px;
    color: var(--gray-700);
}
.endpoint-desc {
    font-size: 12px;
    color: var(--gray-500);
    margin-left: auto;
}

/* ── JSON OUTPUT ── */
.json-output {
    background: var(--gray-900);
    color: #E5E7EB;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-size: 13px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 400px;
    white-space: pre;
    min-height: 80px;
    line-height: 1.7;
}

.json-string  { color: #6EE7B7; }
.json-number  { color: #FCD34D; }
.json-boolean { color: #F87171; }
.json-null    { color: #9CA3AF; }
.json-key     { color: #93C5FD; }

/* ── LOADING ── */
.loading-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.loading-dots span {
    width: 6px;
    height: 6px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: .4; }
    40%            { transform: translateY(-6px); opacity: 1; }
}

/* ── TABLE ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .navbar-links { display: none; }
    .module-grid  { grid-template-columns: 1fr; }
    .stats-row    { grid-template-columns: 1fr; }
}
