/* ==================================================
   RESET & BASE
   ================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #faf9f5;
    --bg-card: #ffffff;
    --bg-user: #1a1a1a;
    --bg-bot: #f5f3ed;
    --text: #1a1a1a;
    --text-muted: #6b6960;
    --border: #e5e3da;
    --accent: #c96442;
    --accent-hover: #b05635;
    --error: #dc2626;
    --success: #16a34a;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.05);
    --max-width: 800px;
}

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

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==================================================
   LOGIN PAGE
   ================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    padding: 40px 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
    text-align: center;
}

.subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-primary {
    width: 100%;
    padding: 11px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 15px;
    transition: background 0.15s;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: background 0.15s;
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
    padding: 8px 16px;
    background: var(--error);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-error { background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

.footer-text {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 24px;
}

/* ==================================================
   CHAT PAGE
   ================================================== */
.chat-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    flex-shrink: 0;
}

.chat-header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-title .dot {
    width: 8px; height: 8px;
    background: var(--success);
    border-radius: 50%;
}

.role-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.role-badge.admin { background: #fef3c7; color: #92400e; }
.role-badge.staff { background: #dbeafe; color: #1e40af; }

.chat-user {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.chat-user .link { color: var(--text-muted); font-size: 13px; }
.chat-user .link:hover { color: var(--accent); }

.chat-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
}

.chat-messages {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome {
    text-align: center;
    padding: 40px 20px;
}

.welcome h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.examples {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 500px;
    margin: 0 auto;
}

.example-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    text-align: left;
    font-size: 14px;
    color: var(--text);
    transition: all 0.15s;
}

.example-btn:hover {
    border-color: var(--accent);
    background: var(--bg-bot);
}

.message {
    display: flex;
    animation: fadeIn 0.2s;
}

.message-user { justify-content: flex-end; }
.message-model { justify-content: flex-start; }
.message-error { justify-content: flex-start; }

.message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

.message-user .message-bubble {
    background: var(--bg-user);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-model .message-bubble {
    background: var(--bg-bot);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.message-error .message-bubble {
    background: #fef2f2;
    color: var(--error);
    border: 1px solid #fecaca;
    border-bottom-left-radius: 4px;
}

.message-bubble code {
    background: rgba(0,0,0,0.08);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 13px;
}

.message-bubble strong { font-weight: 600; }

/* Typing indicator */
.typing {
    display: flex;
    gap: 4px;
    padding: 16px;
}
.typing span {
    width: 8px; height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Input */
.chat-input-container {
    background: var(--bg);
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-input-form {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 8px 8px 16px;
    transition: border-color 0.15s;
}

.chat-input-form:focus-within {
    border-color: var(--accent);
}

#chat-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    resize: none;
    padding: 8px 0;
    max-height: 200px;
    font-size: 15px;
    line-height: 1.5;
}

#send-btn {
    width: 36px; height: 36px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

#send-btn:hover:not(:disabled) { background: var(--accent-hover); }
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.disclaimer {
    max-width: var(--max-width);
    margin: 8px auto 0;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
}

/* ==================================================
   ADMIN PAGE
   ================================================== */
.admin-page { min-height: 100vh; }

.admin-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
}
.admin-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.admin-header h1 { font-size: 18px; font-weight: 600; }

.admin-nav {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.admin-nav a {
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
}
.admin-nav a:hover { color: var(--text); }
.admin-nav a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

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

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.admin-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.admin-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .actions { display: flex; gap: 6px; }

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 8px;
    flex-wrap: wrap;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

/* ==================================================
   RESPONSIVE
   ================================================== */
@media (max-width: 600px) {
    .chat-header, .chat-main, .chat-input-container { padding-left: 12px; padding-right: 12px; }
    .welcome h2 { font-size: 22px; }
    .message-bubble { max-width: 90%; font-size: 14px; }
    .admin-container { padding: 16px; }
    .admin-table { font-size: 12px; }
    .admin-table th, .admin-table td { padding: 8px 6px; }
}

/* ============================================================
   INVOICE CARD STYLES (existing)
   ============================================================ */

.invoice-card {
    margin: 12px 0 4px 0;
    padding: 14px 16px;
    background-color: #FFF5F1;
    border: 1.5px solid #E8542C;
    border-radius: 10px;
    max-width: 360px;
    box-shadow: 0 2px 6px rgba(232, 84, 44, 0.08);
}

.invoice-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.invoice-card-icon {
    font-size: 28px;
    line-height: 1;
}

.invoice-card-info {
    flex: 1;
    min-width: 0;
}

.invoice-card-title {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.invoice-card-number {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    font-family: monospace;
    word-break: break-all;
}

.invoice-card-buttons {
    display: flex;
    gap: 8px;
}

.btn-invoice {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
    border: none;
}

.btn-invoice span {
    font-size: 14px;
    line-height: 1;
}

.btn-invoice-download {
    background-color: #E8542C;
    color: white !important;
}

.btn-invoice-download:hover {
    background-color: #D64820;
    box-shadow: 0 2px 8px rgba(232, 84, 44, 0.3);
}

.btn-invoice-open {
    background-color: white;
    color: #E8542C !important;
    border: 1.5px solid #E8542C;
}

.btn-invoice-open:hover {
    background-color: #FFF5F1;
    box-shadow: 0 2px 8px rgba(232, 84, 44, 0.15);
}

.btn-invoice:active {
    transform: translateY(1px);
}

@media (max-width: 480px) {
    .invoice-card {
        max-width: 100%;
    }
    .invoice-card-buttons {
        flex-direction: column;
    }
}

/* ============================================================
   FILE UPLOAD FEATURES
   ============================================================ */

#upload-btn {
    width: 36px; 
    height: 36px;
    background: transparent;
    color: var(--text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    border: none;
}

#upload-btn:hover:not(:disabled) { 
    background: var(--bg-bot); 
    color: var(--accent); 
}

#upload-btn:disabled { 
    opacity: 0.4; 
    cursor: not-allowed; 
}

#file-input {
    display: none;
}

.file-preview-container {
    max-width: var(--max-width);
    margin: 0 auto 8px auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: none;
    align-items: center;
    gap: 12px;
}

.file-preview-container.active {
    display: flex;
}

.file-preview-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: var(--bg-bot);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    font-size: 24px;
}

.file-preview-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-info {
    flex: 1;
    min-width: 0;
}

.file-preview-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.file-preview-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.15s;
    flex-shrink: 0;
    border: none;
}

.file-preview-remove:hover {
    background: #fef2f2;
    color: var(--error);
}

.message-attachment {
    margin-top: 8px;
    padding: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 280px;
}

.message-attachment-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.message-attachment-info {
    flex: 1;
    min-width: 0;
}

.message-attachment-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-attachment-size {
    font-size: 10px;
    opacity: 0.7;
}

.message-attachment-image {
    margin-top: 8px;
    max-width: 280px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.message-attachment-image img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 400px;
    object-fit: contain;
    background: #000;
}

.upload-progress {
    max-width: var(--max-width);
    margin: 0 auto 8px auto;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    display: none;
}

.upload-progress.active {
    display: block;
}

.upload-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s ease;
}

@media (max-width: 600px) {
    .file-preview-container {
        padding: 8px 10px;
    }
    .file-preview-thumbnail {
        width: 40px;
        height: 40px;
    }
    .file-preview-name {
        font-size: 12px;
    }
    .message-attachment,
    .message-attachment-image {
        max-width: 100%;
    }
}

#file-input,
input[type="file"]#file-input {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.file-preview-container:not(.active) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* ============================================================
   PDF CARD STYLES (existing)
   ============================================================ */

.pdf-card {
    margin: 12px 0 4px 0;
    padding: 14px 16px;
    background-color: #FFF5F1;
    border: 1.5px solid #E8542C;
    border-radius: 10px;
    max-width: 360px;
    box-shadow: 0 2px 6px rgba(232, 84, 44, 0.08);
}

.pdf-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.pdf-card-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.pdf-card-info {
    flex: 1;
    min-width: 0;
}

.pdf-card-title {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.pdf-card-number {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    font-family: monospace;
    word-break: break-all;
}

.pdf-card-buttons {
    display: flex;
    gap: 8px;
}

.btn-pdf {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
    border: none;
}

.btn-pdf span {
    font-size: 14px;
    line-height: 1;
}

.btn-pdf-download {
    background-color: #E8542C;
    color: white !important;
}

.btn-pdf-download:hover {
    background-color: #D64820;
    box-shadow: 0 2px 8px rgba(232, 84, 44, 0.3);
}

.btn-pdf-open {
    background-color: white;
    color: #E8542C !important;
    border: 1.5px solid #E8542C;
}

.btn-pdf-open:hover {
    background-color: #FFF5F1;
    box-shadow: 0 2px 8px rgba(232, 84, 44, 0.15);
}

.btn-pdf:active {
    transform: translateY(1px);
}

.pdf-card-penawaran {
    background-color: #F0FAF5;
    border-color: #2E8B57;
    box-shadow: 0 2px 6px rgba(46, 139, 87, 0.08);
}

.pdf-card-penawaran .pdf-card-title {
    color: #2E8B57;
}

.pdf-card-penawaran .pdf-card-number {
    color: #1F5F3B;
}

.pdf-card-penawaran .btn-pdf-download {
    background-color: #2E8B57;
}

.pdf-card-penawaran .btn-pdf-download:hover {
    background-color: #246E45;
    box-shadow: 0 2px 8px rgba(46, 139, 87, 0.3);
}

.pdf-card-penawaran .btn-pdf-open {
    color: #2E8B57 !important;
    border-color: #2E8B57;
}

.pdf-card-penawaran .btn-pdf-open:hover {
    background-color: #F0FAF5;
    box-shadow: 0 2px 8px rgba(46, 139, 87, 0.15);
}

@media (max-width: 480px) {
    .pdf-card {
        max-width: 100%;
    }
    .pdf-card-buttons {
        flex-direction: column;
    }
}

/* ============================================================
   BRAIN SELECTOR STYLES (FASE 1)
   ============================================================ */

.brain-selector {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.brain-selector.switching {
    opacity: 0.5;
    pointer-events: none;
}

.brain-selector-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.brain-selector-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.brain-toggle-group {
    display: inline-flex;
    gap: 4px;
    background: var(--bg);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.brain-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    white-space: nowrap;
}

.brain-toggle:hover:not(.active):not(.disabled) {
    background: rgba(201, 100, 66, 0.08);
    color: var(--text);
}

.brain-toggle.active {
    background: var(--bg-card);
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.brain-toggle.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
}

.brain-toggle.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
}

.brain-toggle.disabled::before {
    content: 'ðŸ”’';
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 10px;
    background: var(--bg-card);
    border-radius: 50%;
    padding: 1px;
}

.brain-icon {
    font-size: 14px;
    line-height: 1;
}

.brain-name {
    line-height: 1;
}

.brain-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: rgba(0,0,0,0.05);
    color: var(--text-muted);
    border: 1px solid rgba(0,0,0,0.06);
}

.brain-badge-gemini {
    background: #e7f5ee;
    color: #15803d;
    border-color: #bbf7d0;
}

.brain-badge-claude {
    background: #f3e8ff;
    color: #7c3aed;
    border-color: #ddd6fe;
}

.brain-badge-fallback {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.brain-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 360px;
    background: var(--text);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15), 0 4px 10px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateX(120%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    pointer-events: none;
}

.brain-toast.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.brain-toast.toast-success {
    background: #16a34a;
    color: white;
}

.brain-toast.toast-error {
    background: #dc2626;
    color: white;
}

.brain-toast.toast-warning {
    background: #d97706;
    color: white;
}

.brain-toast.toast-info {
    background: var(--text);
    color: white;
}

@media (max-width: 600px) {
    .brain-selector {
        padding: 8px 12px;
    }
    
    .brain-selector-inner {
        gap: 8px;
    }
    
    .brain-selector-label {
        font-size: 12px;
    }
    
    .brain-toggle {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .brain-icon {
        font-size: 13px;
    }
    
    .brain-toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
        font-size: 13px;
    }
}

/* ============================================================
   ============================================================
   AGENT SELECTOR STYLES (BARU - FASE 2 MULTI-AGENT)
   ============================================================
   ============================================================
   Styling untuk dropdown agent (Tara, Marketing, Financial, 
   Design, Customer Service) â€” admin only.
   ============================================================ */

/* -------------------- AGENT SELECTOR CONTAINER -------------------- */

.agent-selector {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
    position: relative;
    z-index: 100;
}

.agent-selector.switching {
    opacity: 0.5;
    pointer-events: none;
}

.agent-selector-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.agent-selector-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* -------------------- DROPDOWN WRAPPER -------------------- */

.agent-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

/* -------------------- DROPDOWN BUTTON (Trigger) -------------------- */

.agent-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 180px;
    position: relative;
}

.agent-dropdown-btn:hover {
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.agent-dropdown-btn.open {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 100, 66, 0.1);
}

.agent-current-emoji {
    font-size: 16px;
    line-height: 1;
}

.agent-current-name {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-dropdown-arrow {
    font-size: 9px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    margin-left: 4px;
}

.agent-dropdown-btn.open .agent-dropdown-arrow {
    transform: rotate(180deg);
}

/* -------------------- DROPDOWN MENU (List) -------------------- */

.agent-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 320px;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    padding: 6px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top left;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 420px;
    overflow-y: auto;
}

.agent-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.agent-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.agent-dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

.agent-dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.agent-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* -------------------- DROPDOWN ITEMS -------------------- */

.agent-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    width: 100%;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
    margin-bottom: 2px;
}

.agent-dropdown-item:last-child {
    margin-bottom: 0;
}

.agent-dropdown-item:hover {
    background: var(--bg-bot);
}

.agent-dropdown-item.active {
    background: rgba(201, 100, 66, 0.08);
}

.agent-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.agent-item-emoji {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-bot);
    border-radius: 8px;
}

.agent-item-text {
    flex: 1;
    min-width: 0;
}

.agent-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-item-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.agent-default-tag {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 8px;
    background: #fef3c7;
    color: #92400e;
    flex-shrink: 0;
}

.agent-item-brain {
    font-size: 16px;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50%;
}

/* -------------------- COLOR THEMES per AGENT -------------------- */

.agent-dropdown-item.theme-orange .agent-item-emoji {
    background: #fff1e6;
}

.agent-dropdown-item.theme-orange.active {
    background: #fff1e6;
}

.agent-dropdown-item.theme-purple .agent-item-emoji {
    background: #f3e8ff;
}

.agent-dropdown-item.theme-purple:hover {
    background: #f9f5ff;
}

.agent-dropdown-item.theme-purple.active {
    background: #f3e8ff;
}

.agent-dropdown-item.theme-green .agent-item-emoji {
    background: #dcfce7;
}

.agent-dropdown-item.theme-green:hover {
    background: #f0fdf4;
}

.agent-dropdown-item.theme-green.active {
    background: #dcfce7;
}

.agent-dropdown-item.theme-pink .agent-item-emoji {
    background: #fce7f3;
}

.agent-dropdown-item.theme-pink:hover {
    background: #fdf2f8;
}

.agent-dropdown-item.theme-pink.active {
    background: #fce7f3;
}

.agent-dropdown-item.theme-blue .agent-item-emoji {
    background: #dbeafe;
}

.agent-dropdown-item.theme-blue:hover {
    background: #eff6ff;
}

.agent-dropdown-item.theme-blue.active {
    background: #dbeafe;
}

/* -------------------- DROPDOWN BUTTON THEME per active agent -------------------- */

.agent-dropdown-wrapper[data-theme="orange"] .agent-dropdown-btn {
    background: linear-gradient(to right, #fff1e6, var(--bg-card));
    border-color: #fed7aa;
}

.agent-dropdown-wrapper[data-theme="purple"] .agent-dropdown-btn {
    background: linear-gradient(to right, #f3e8ff, var(--bg-card));
    border-color: #ddd6fe;
}

.agent-dropdown-wrapper[data-theme="green"] .agent-dropdown-btn {
    background: linear-gradient(to right, #dcfce7, var(--bg-card));
    border-color: #bbf7d0;
}

.agent-dropdown-wrapper[data-theme="pink"] .agent-dropdown-btn {
    background: linear-gradient(to right, #fce7f3, var(--bg-card));
    border-color: #fbcfe8;
}

.agent-dropdown-wrapper[data-theme="blue"] .agent-dropdown-btn {
    background: linear-gradient(to right, #dbeafe, var(--bg-card));
    border-color: #bfdbfe;
}

/* -------------------- MOBILE RESPONSIVE -------------------- */

@media (max-width: 600px) {
    .agent-selector {
        padding: 8px 12px;
    }
    
    .agent-selector-inner {
        gap: 8px;
    }
    
    .agent-selector-label {
        font-size: 12px;
    }
    
    .agent-dropdown-btn {
        min-width: 140px;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .agent-dropdown-menu {
        min-width: 280px;
        max-width: calc(100vw - 40px);
        left: 0;
    }
    
    .agent-item-desc {
        max-width: 200px;
        font-size: 10px;
    }
    
    .agent-item-name {
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .agent-dropdown-menu {
        min-width: 260px;
    }
    
    .agent-item-emoji {
        width: 28px;
        height: 28px;
        font-size: 20px;
    }
}

/* ============================================================
   🆕 SHARE BUTTON & DROPDOWN MENU - 29 APRIL 2026
   Append to: assets/style.css
   
   FITUR:
   ✅ Share button dengan icon + arrow
   ✅ Dropdown menu floating (4 opsi: WhatsApp, Email, Telegram, Copy)
   ✅ Smooth animation
   ✅ Mobile responsive
   ✅ Theme-aware (pakai existing CSS variables)
   ============================================================ */

/* Wrapper untuk share button + dropdown */
.btn-pdf-share-wrapper {
    position: relative;
    display: inline-block;
}

/* Share button styling (mirip btn-pdf existing) */
.btn-pdf-share {
    background-color: #6c757d;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-pdf-share:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.btn-pdf-share.open {
    background-color: #495057;
}

.btn-pdf-share .share-arrow {
    font-size: 9px;
    margin-left: 2px;
    transition: transform 0.2s ease;
}

.btn-pdf-share.open .share-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu — hidden by default */
.share-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 170px;
    z-index: 1000;
    
    /* Hidden state */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    
    padding: 6px;
    overflow: hidden;
}

/* Open state */
.share-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Each share option */
.share-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: #333;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.share-option:hover {
    background-color: rgba(201, 100, 66, 0.08); /* tint dari --accent #c96442 */
    color: #c96442;
}

.share-option:active {
    background-color: rgba(201, 100, 66, 0.15);
}

.share-option .share-icon {
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

/* Special hover untuk Copy Link (highlight) */
.share-option[data-share="copy"]:hover {
    background-color: rgba(40, 167, 69, 0.08);
    color: #28a745;
}

/* Special hover untuk WhatsApp (green tint) */
.share-option[data-share="whatsapp"]:hover {
    background-color: rgba(37, 211, 102, 0.08);
    color: #25d366;
}

/* Special hover untuk Email */
.share-option[data-share="email"]:hover {
    background-color: rgba(0, 122, 255, 0.08);
    color: #007AFF;
}

/* Special hover untuk Telegram */
.share-option[data-share="telegram"]:hover {
    background-color: rgba(0, 136, 204, 0.08);
    color: #0088cc;
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
    /* Stack buttons vertical di mobile */
    .pdf-card-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .btn-pdf-share-wrapper {
        flex: 1;
        min-width: 90px;
    }
    
    .btn-pdf-share {
        width: 100%;
        justify-content: center;
    }
    
    /* Dropdown full width di mobile */
    .share-menu {
        right: 0;
        left: 0;
        min-width: unset;
        width: 100%;
    }
    
    .share-option {
        padding: 12px 14px;
        font-size: 15px;
    }
}

/* ============================================================
   DARK MODE SUPPORT (kalau Bapak punya dark mode)
   ============================================================ */

@media (prefers-color-scheme: dark) {
    .share-menu {
        background: #2a2a2a;
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    }
    
    .share-option {
        color: #e0e0e0;
    }
    
    .share-option:hover {
        background-color: rgba(201, 100, 66, 0.15);
    }
}

/* ============================================================
   ACCESSIBILITY — Focus state
   ============================================================ */

.btn-pdf-share:focus-visible,
.share-option:focus-visible {
    outline: 2px solid #c96442;
    outline-offset: 2px;
}
