/* ===== Poke Rey - Dark Theme Stylesheet ===== */

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #111640;
    --bg-panel: #161b4a;
    --bg-input: #1a2050;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --text-muted: #5a6380;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-green: #22c55e;
    --accent-gold: #eab308;
    --accent-red: #ef4444;
    --border-color: #2a3060;
    --border-focus: #3b82f6;
    --border-success: #22c55e;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 20px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.poke-dark {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ===== Login Page ===== */
.poke-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse at 50% 40%, rgba(59,130,246,0.12) 0%, transparent 60%);
}

.poke-login-container {
    text-align: center;
    padding: 60px 40px;
    width: 100%;
}

.poke-login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 40px;
}

.poke-star-icon { width: 40px; height: 40px; }
.poke-dots-icon { width: 40px; height: 40px; }
.poke-divider { color: var(--text-muted); font-size: 32px; font-weight: 200; }

.poke-logo-text {
    font-family: Inter;
    font-size: 44.524px;
    font-style: normal;
    font-weight: 800;
    line-height: 85px; /* 190.909% */
    letter-spacing: 12.143px;
    text-transform: uppercase;
    background: linear-gradient(180deg, #FFF 0%, #93C5FD 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.poke-login-title {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.poke-login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.poke-login-subtitle sup { font-size: 9px; }

.btn-dlrsecured {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-dlrsecured:hover { background: var(--accent-blue-hover); }
.btn-dlrsecured i { font-size: 18px; }

.poke-login-footer {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Header ===== */
.poke-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.poke-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.poke-header-dots { width: 24px; height: 24px; }

.poke-header-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 6px;
    color: var(--text-primary);
}

.poke-header-center { flex: 1; text-align: center; }

.poke-env-badge {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 6px;
}

.poke-env-badge.env-staging { color: var(--accent-gold); }
.poke-env-badge.env-prod { color: var(--accent-red); }

.poke-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: var(--accent-blue-hover); }

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.2s;
}

.btn-outline:hover { border-color: var(--text-secondary); }

.btn-outline.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-text:hover { color: var(--text-primary); }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}

.btn-icon:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.inline-form { display: inline; }
.btn-logout { gap: 6px; }

/* ===== Main Content ===== */
.poke-main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 24px;
}

.poke-form-container { display: flex; flex-direction: column; gap: 20px; }

/* ===== Form Fields ===== */
.poke-field { display: flex; flex-direction: column; gap: 6px; }

.poke-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.poke-filters-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.poke-select, .poke-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s;
}

.poke-select:focus, .poke-input:focus { border-color: var(--border-focus); }
.poke-select:disabled { color: var(--text-muted); cursor: not-allowed; }

.poke-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Dealer Input */
.poke-dealer-input-wrapper { position: relative; }

.poke-dealer-input-wrapper.selected .poke-input {
    border-color: var(--border-success);
}

.poke-dealer-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.poke-dealer-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
}

.poke-dealer-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.poke-dealer-item:hover { background: rgba(59,130,246,0.15); }

.poke-dealer-item-name { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.poke-dealer-item-cif { font-size: 12px; color: var(--text-secondary); }

/* Prompt */
.poke-prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.poke-textarea-wrapper { position: relative; }

.poke-textarea {
    width: 100%;
    padding: 12px 14px;
    padding-bottom: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    resize: vertical;
    outline: none;
    min-height: 150px;
    transition: border-color 0.2s;
}

.poke-textarea:focus { border-color: var(--border-focus); }

.poke-textarea::placeholder { color: var(--text-muted); }

.poke-textarea-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
}

.poke-send-row { text-align: center; }

/* ===== Response Area ===== */
.poke-response-area {
    margin-top: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.poke-response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.poke-response-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--accent-blue);
}

.poke-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-blue);
    animation: pulse 1.5s infinite;
}

.poke-status-dot.complete { background: var(--accent-green); animation: none; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.poke-response-tabs { display: flex; gap: 4px; }

.poke-tab {
    padding: 6px 10px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.poke-tab.active { background: rgba(59,130,246,0.15); border-color: var(--accent-blue); color: var(--text-primary); }

.poke-tab-content { padding: 16px; }
.poke-tab-content:not(.active) { display: none; }

.poke-response-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.poke-raw-section { margin-bottom: 16px; }
.poke-raw-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.poke-code-block {
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 12px;
    color: #e6edf3;
    overflow-x: auto;
    white-space: pre;
    max-height: 400px;
    overflow-y: auto;
}

.poke-response-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.poke-response-feedback {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.poke-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}

.poke-status-badge.success { background: rgba(34,197,94,0.15); color: var(--accent-green); border: 1px solid rgba(34,197,94,0.3); }
.poke-status-badge.error { background: rgba(239,68,68,0.15); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.3); }

/* ===== Modal ===== */
.poke-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.poke-modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.poke-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.poke-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.poke-modal-header .btn-icon { font-size: 24px; }

.poke-dealer-list {
    overflow-y: auto;
    flex: 1;
    margin-top: 12px;
}

/* ===== Log Table ===== */
.poke-log-container { overflow-x: auto; }

.poke-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.poke-log-table th {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.poke-log-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(42,48,96,0.5);
    color: var(--text-primary);
}

.poke-log-table tr:hover td { background: rgba(255,255,255,0.02); }
.poke-log-empty { text-align: center; color: var(--text-muted); padding: 40px 16px !important; }

.poke-log-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 16px;
}

.btn-poke-again {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-poke-again:hover { background: var(--accent-blue-hover); }

/* ===== Error Page ===== */
.poke-error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 16px;
    text-align: center;
}

.poke-error-container code {
    background: var(--bg-input);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

/* ===== Prism.js overrides — keep our code block chrome, let Prism handle token colors ===== */
/* Prism's pre[class*="language-"] selector has specificity (0,1,1); we need (0,2,1) to win */
pre.poke-code-block[class*="language-"] {
    background: #0d1117;
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 0;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 12px;
    text-shadow: none;
}

pre.poke-code-block[class*="language-"] > code {
    background: none;
    font-family: inherit;
    font-size: inherit;
    text-shadow: none;
    padding: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .poke-filters-row { grid-template-columns: 1fr; }
    .poke-header { flex-wrap: wrap; gap: 8px; }
    .poke-header-center { order: 3; flex-basis: 100%; }
    .poke-login-title { font-size: 36px; }
}
