/* ═══ CONVERTED TO LIGHT WARM THEME + 1.2x FONTS ═══ */
/* ══════════════════════════════════════════════════════════════
   M7: Ezibee AI Report — CSS
   Theme: dark glassmorphism (giống ai-energy.css)
   ══════════════════════════════════════════════════════════════ */

/* ── Topbar ──────────────────────────────────────────────── */
.rpt-topbar {
    background: linear-gradient(180deg, #fffefa, rgba(8,14,31,.95));
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 16px;
    padding: 16px 24px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.rpt-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rpt-logo {
    font-size: 33.6px;
}

.rpt-title {
    font-size: 21.6px;
    font-weight: 800;
    color: #2d2d42;
}

.rpt-subtitle {
    font-size: 14.4px;
    color: #9e9eb0;
}

    .rpt-subtitle .dot {
        color: #3b82f6;
        margin: 0 6px;
    }

.rpt-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Tabs ────────────────────────────────────────────────── */
.rpt-tabs {
    display: flex;
    gap: 4px;
}

.rpt-tab {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 15.6px;
    font-weight: 600;
    color: #9e9eb0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: .2s;
}

    .rpt-tab:hover {
        background: rgba(0,0,0,.03);
        color: #2d2d42;
    }

    .rpt-tab.active {
        background: rgba(59,130,246,.18);
        color: #3b82f6;
    }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14.4px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: .2s;
    color: #2d2d42;
}

    .btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.btn-primary {
    background: #3b82f6;
}

    .btn-primary:hover:not(:disabled) {
        background: #2563eb;
    }

.btn-success {
    background: #22c55e;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(0,0,0,.06);
    color: #9e9eb0;
}

    .btn-ghost:hover:not(:disabled) {
        border-color: #3b82f6;
        color: #3b82f6;
    }

.btn-sm {
    padding: 5px 10px;
    font-size: 13.2px;
}

.btn-purple {
    background: #7c3aed;
}

    .btn-purple:hover:not(:disabled) {
        background: #7c3aed;
    }

.btn-inline-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 16.8px;
    padding: 0 4px;
}

/* ── Select ──────────────────────────────────────────────── */
.rpt-select {
    appearance: none;
    background: rgba(0,0,0,.03);
    border: 1px solid #e0ddd6;
    color: #2d2d42;
    padding: 7px 28px 7px 10px;
    border-radius: 8px;
    font-size: 14.4px;
    cursor: pointer;
}

    .rpt-select:focus {
        border-color: #3b82f6;
        outline: none;
    }

/* ── Config Input ────────────────────────────────────────── */
.config-input {
    background: rgba(0,0,0,.03);
    border: 1px solid #e0ddd6;
    color: #2d2d42;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 15.6px;
    width: 80px;
    text-align: right;
}

    .config-input:focus {
        border-color: #3b82f6;
        outline: none;
    }

/* ── Placeholder ─────────────────────────────────────────── */
.rpt-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #c5c5d0;
    font-size: 16.8px;
    border: 1px dashed rgba(0,0,0,.06);
    border-radius: 16px;
    margin: 16px 0;
}

/* ── Alert / Error ───────────────────────────────────────── */
.rpt-alert {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 15.6px;
    margin-bottom: 12px;
}

    .rpt-alert.error {
        background: rgba(239,68,68,.12);
        border: 1px solid rgba(239,68,68,.3);
        color: #ef4444;
    }

/* ── Filter Bar ──────────────────────────────────────────── */
.rpt-filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── KPI Grid (reuse từ ai-energy.css, đảm bảo có) ──────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.kpi {
    background: linear-gradient(135deg, #fffefa, rgba(20,32,58,.9));
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    transition: .2s;
}

    .kpi:hover {
        border-color: rgba(0,0,0,.06);
    }

.kpi-value {
    font-size: 33.6px;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1.2;
}

.kpi-label {
    font-size: 13.2px;
    color: #9e9eb0;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.kpi-sub {
    font-size: 12px;
    color: #c5c5d0;
    margin-top: 2px;
}

.kv-green {
    color: #22c55e;
}

.kv-orange {
    color: #f59e0b;
}

.kv-red {
    color: #ef4444;
}

.kv-gray {
    color: #475569;
}

/* ══════════════════════════════════════════════════════════════
   TAB 1: REPORT CARDS
   ══════════════════════════════════════════════════════════════ */

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.report-card {
    background: #fffefa;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 10px;
    padding: 16px;
    transition: .2s;
    cursor: pointer;
    position: relative;
}

    .report-card:hover {
        border-color: rgba(0,0,0,.06);
        transform: translateY(-1px);
    }

    .report-card.anomaly-border {
        border-color: rgba(239,68,68,.3);
    }

    .report-card.generating-border {
        border-color: rgba(59,130,246,.3);
    }

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.report-type {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    display: inline-block;
}

.type-daily {
    background: rgba(59,130,246,.18);
    color: #3b82f6;
}

.type-weekly {
    background: rgba(124,58,237,.08);
    color: #7c3aed;
}

.type-alert {
    background: rgba(239,68,68,.12);
    color: #ef4444;
}

.type-energy {
    background: rgba(34,197,94,.12);
    color: #22c55e;
}

.type-forecast {
    background: rgba(245,158,11,.12);
    color: #f59e0b;
}

.report-title {
    font-size: 16.8px;
    font-weight: 700;
    color: #2d2d42;
    margin-top: 6px;
}

.report-time {
    font-size: 12px;
    color: #c5c5d0;
    margin-top: 2px;
}

.report-preview {
    font-size: 14.4px;
    color: #9e9eb0;
    line-height: 1.6;
    margin-top: 8px;
    max-height: 80px;
    overflow: hidden;
    position: relative;
}

    .report-preview::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 30px;
        background: linear-gradient(transparent, #fffefa);
    }

.report-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,.03);
}

.report-status {
    font-size: 12px;
    font-weight: 600;
}

.status-sent {
    color: #22c55e;
}

.status-draft {
    color: #f59e0b;
}

.status-generating {
    color: #3b82f6;
    animation: pulse 1.5s infinite;
}

.status-failed {
    color: #ef4444;
}

.report-actions-row {
    display: flex;
    gap: 6px;
}

/* AI generating animation */
.ai-generating {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: rgba(59,130,246,.18);
    border: 1px solid rgba(59,130,246,.2);
    border-radius: 8px;
    margin: 12px 0;
}

.ai-gen-text {
    font-size: 14.4px;
    color: #3b82f6;
}

.ai-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    animation: dot-bounce 1.4s infinite ease-in-out both;
}

    .ai-dots span:nth-child(1) {
        animation-delay: -.32s;
    }

    .ai-dots span:nth-child(2) {
        animation-delay: -.16s;
    }

@keyframes dot-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

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

    50% {
        opacity: .5;
    }
}

/* ══════════════════════════════════════════════════════════════
   TAB 2: REPORT DETAIL
   ══════════════════════════════════════════════════════════════ */

.report-detail {
    background: #fffefa;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
}

.report-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0,0,0,.06);
    flex-wrap: wrap;
    gap: 12px;
}

.report-detail h1 {
    font-size: 26.4px;
    font-weight: 800;
    color: #2d2d42;
}

.report-detail-meta {
    font-size: 14.4px;
    color: #c5c5d0;
    margin-top: 4px;
}

.report-detail-actions {
    display: flex;
    gap: 8px;
}

/* AI-generated narrative content */
.report-narrative-content {
    font-size: 15.6px;
    color: #9e9eb0;
    line-height: 1.8;
}

    .report-narrative-content strong,
    .report-narrative-content b {
        color: #2d2d42;
    }

    .report-narrative-content em {
        color: #cbd5e1;
    }

    .report-narrative-content h1 {
        font-size: 24px;
        font-weight: 800;
        color: #2d2d42;
        margin: 20px 0 12px;
    }

    .report-narrative-content h2 {
        font-size: 19.2px;
        font-weight: 700;
        color: #3b82f6;
        margin: 20px 0 10px;
        padding-bottom: 6px;
        border-bottom: 1px solid rgba(59,130,246,.15);
    }

    .report-narrative-content h3 {
        font-size: 15.6px;
        font-weight: 700;
        color: #2d2d42;
        margin: 14px 0 8px;
    }

    .report-narrative-content h4 {
        font-size: 14.4px;
        font-weight: 700;
        color: #cbd5e1;
        margin: 12px 0 6px;
    }

    .report-narrative-content p {
        margin: 8px 0;
        color: #9e9eb0;
    }

    .report-narrative-content a {
        color: #3b82f6;
        text-decoration: underline;
    }

        .report-narrative-content a:hover {
            color: #b8892e;
        }

    .report-narrative-content ul,
    .report-narrative-content ol {
        margin: 8px 0;
        padding-left: 20px;
        color: #9e9eb0;
    }

    .report-narrative-content li {
        margin: 4px 0;
    }

        .report-narrative-content li::marker {
            color: #3b82f6;
        }

    .report-narrative-content hr {
        border: none;
        border-top: 1px solid rgba(0,0,0,.06);
        margin: 16px 0;
    }

    .report-narrative-content code {
        background: rgba(0,0,0,.03);
        padding: 2px 6px;
        border-radius: 4px;
        font-size: 13.2px;
        color: #2d2d42;
    }

    .report-narrative-content pre {
        background: rgba(0,0,0,.03);
        padding: 12px;
        border-radius: 8px;
        overflow-x: auto;
        margin: 12px 0;
    }

        .report-narrative-content pre code {
            padding: 0;
            background: transparent;
        }

    .report-narrative-content blockquote {
        border-left: 3px solid #3b82f6;
        padding-left: 12px;
        margin: 12px 0;
        color: #cbd5e1;
        font-style: italic;
    }

    .report-narrative-content dl {
        margin: 10px 0;
    }

    .report-narrative-content dt {
        font-weight: 700;
        color: #2d2d42;
        margin-top: 8px;
        font-size: 14.4px;
    }

    .report-narrative-content dd {
        margin-left: 16px;
        color: #9e9eb0;
        font-size: 14.4px;
    }

    .report-narrative-content img {
        max-width: 100%;
        border-radius: 8px;
        margin: 12px 0;
    }

    .report-narrative-content small {
        font-size: 13.2px;
        color: #c5c5d0;
    }

    .report-narrative-content span {
        color: inherit;
    }

    /* ── DARK THEME ENFORCEMENT: tất cả div bên trong narrative ── */
    .report-narrative-content div {
        background: transparent;
        color: #9e9eb0;
        border-color: rgba(0,0,0,.06);
    }

        .report-narrative-content div strong,
        .report-narrative-content div b {
            color: #2d2d42;
        }

        .report-narrative-content div h2,
        .report-narrative-content div h3 {
            color: #3b82f6;
        }

        /* Card-like containers: bất kỳ div nào có border/shadow (sau khi strip inline bg) */
        .report-narrative-content div[style*="border"],
        .report-narrative-content div[style*="shadow"],
        .report-narrative-content div[style*="padding"] {
            background: linear-gradient(135deg, #fffefa, rgba(20,32,58,.9)) !important;
            border: 1px solid rgba(0,0,0,.06) !important;
            border-radius: 10px;
            color: #9e9eb0;
        }

    /* ── Hero / Banner container (thường là div đầu tiên có text-align center) ── */
    .report-narrative-content > div:first-child[style*="text-align"],
    .report-narrative-content > div:first-child[style*="gradient"] {
        background: linear-gradient(135deg, #fffefa 0%, #162040 50%, #0b1120 100%) !important;
        border: 1px solid rgba(0,0,0,.06) !important;
        border-radius: 12px !important;
        color: #2d2d42 !important;
        padding: 24px !important;
        margin-bottom: 16px;
    }

        .report-narrative-content > div:first-child[style*="text-align"] *,
        .report-narrative-content > div:first-child[style*="gradient"] * {
            color: inherit;
        }

    /* ── Table (catch tất cả tables AI tạo) ── */
    .report-narrative-content table {
        width: 100%;
        border-collapse: collapse;
        margin: 12px 0;
        background: transparent;
    }

    .report-narrative-content thead,
    .report-narrative-content thead tr {
        background: rgba(0,0,0,.03) !important;
    }

    .report-narrative-content th {
        text-align: left;
        padding: 8px 12px;
        font-size: 13.2px;
        font-weight: 600;
        color: #9e9eb0 !important;
        text-transform: uppercase;
        letter-spacing: .5px;
        background: rgba(0,0,0,.03) !important;
        border-bottom: 1px solid rgba(0,0,0,.06) !important;
    }

    .report-narrative-content td {
        padding: 8px 12px;
        font-size: 14.4px;
        color: #9e9eb0;
        border-bottom: 1px solid rgba(0,0,0,.01) !important;
        background: transparent !important;
    }

    .report-narrative-content tr {
        background: transparent !important;
    }

    .report-narrative-content tbody tr:hover {
        background: rgba(0,0,0,.01) !important;
    }

    .report-narrative-content td strong,
    .report-narrative-content td b {
        color: #2d2d42 !important;
    }

/* Inline metrics */
.metric-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14.4px;
}

.metric-good {
    background: rgba(34,197,94,.12);
    color: #22c55e;
}

.metric-bad {
    background: rgba(239,68,68,.12);
    color: #ef4444;
}

.metric-neutral {
    background: rgba(0,0,0,.03);
    color: #2d2d42;
}

/* Report table (standalone, ngoài narrative) */
.report-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

    .report-table th {
        text-align: left;
        padding: 8px 12px;
        font-size: 13.2px;
        font-weight: 600;
        color: #9e9eb0;
        text-transform: uppercase;
        letter-spacing: .5px;
        background: rgba(0,0,0,.03);
        border-bottom: 1px solid rgba(0,0,0,.06);
    }

    .report-table td {
        padding: 8px 12px;
        font-size: 14.4px;
        border-bottom: 1px solid rgba(0,0,0,.01);
    }

    .report-table tr:hover {
        background: rgba(0,0,0,.01);
    }

/* Highlight boxes (used by AI in narrative) */
.highlight-success {
    background: rgba(34,197,94,.12);
    border: 1px solid rgba(34,197,94,.2);
    color: #22c55e;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 14.4px;
    line-height: 1.6;
}

.highlight-warning {
    background: rgba(245,158,11,.12);
    border: 1px solid rgba(245,158,11,.2);
    color: #f59e0b;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 14.4px;
    line-height: 1.6;
}

.highlight-danger {
    background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.2);
    color: #ef4444;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 14.4px;
    line-height: 1.6;
}

.highlight-info {
    background: rgba(59,130,246,.18);
    border: 1px solid rgba(59,130,246,.2);
    color: #3b82f6;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 14.4px;
    line-height: 1.6;
}

    .highlight-info code {
        background: rgba(0,0,0,.03);
        padding: 2px 6px;
        border-radius: 4px;
        font-size: 13.2px;
        margin: 2px;
    }

.report-snapshot-info {
    font-size: 13.2px;
    color: #c5c5d0;
    margin-top: 16px;
    padding: 10px 14px;
    background: rgba(0,0,0,.03);
    border-radius: 8px;
}

    .report-snapshot-info span {
        margin-right: 8px;
    }

.report-detail-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,.06);
    text-align: center;
    font-size: 13.2px;
    color: #c5c5d0;
}

.trend-down {
    color: #22c55e;
}

.trend-up {
    color: #ef4444;
}

.trend-flat {
    color: #c5c5d0;
}

/* ══════════════════════════════════════════════════════════════
   TAB 3: SCHEDULE & CONFIG
   ══════════════════════════════════════════════════════════════ */

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.schedule-card {
    background: #fffefa;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 10px;
    padding: 16px;
}

.schedule-title {
    font-size: 15.6px;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.schedule-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid rgba(0,0,0,.01);
    font-size: 14.4px;
    color: #9e9eb0;
}

    .schedule-row:last-child {
        border-bottom: none;
    }

.schedule-value {
    color: #2d2d42;
    font-weight: 600;
}

/* Toggle */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

    .toggle input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #475569;
    border-radius: 22px;
    transition: .3s;
}

    .toggle-slider:before {
        content: "";
        position: absolute;
        height: 16px;
        width: 16px;
        left: 3px;
        bottom: 3px;
        background: #fff;
        border-radius: 50%;
        transition: .3s;
    }

.toggle input:checked + .toggle-slider {
    background: #22c55e;
}

    .toggle input:checked + .toggle-slider:before {
        transform: translateX(18px);
    }

/* ══════════════════════════════════════════════════════════════
   TAB 4: AI PROMPT
   ══════════════════════════════════════════════════════════════ */

.panel {
    background: #fffefa;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0,0,0,.06);
    flex-wrap: wrap;
    gap: 10px;
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    color: #2d2d42;
}

.panel-sub {
    font-size: 13.2px;
    color: #c5c5d0;
    margin-top: 2px;
}

.panel-body {
    padding: 18px;
}

.prompt-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.prompt-editor {
    background: rgba(0,0,0,.03);
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 8px;
    padding: 14px;
    margin: 10px 0;
}

    .prompt-editor textarea {
        width: 100%;
        min-height: 100px;
        background: transparent;
        border: none;
        color: #2d2d42;
        font-family: 'Inter', system-ui, -apple-system, sans-serif;
        font-size: 14.4px;
        line-height: 1.6;
        resize: vertical;
    }

        .prompt-editor textarea:focus {
            outline: none;
        }

.prompt-editor-label {
    font-size: 12px;
    color: #c5c5d0;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .rpt-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .report-grid {
        grid-template-columns: 1fr;
    }

    .schedule-grid {
        grid-template-columns: 1fr;
    }

    .report-detail-header {
        flex-direction: column;
    }

    .report-narrative-content table {
        font-size: 13.2px;
    }

    .report-narrative-content th, .report-narrative-content td {
        padding: 6px 8px;
    }
}

/* ══════════════════════════════════════════════════════════════
   DARK THEME: Select / Option / OptGroup
   Fix dropdown trắng khi mở trên Chrome/Edge
   ══════════════════════════════════════════════════════════════ */
select,
.als-wrap select {
    background-color: #fffefa !important;
    color: #2d2d42 !important;
}

    select option {
        background-color: #fffefa;
        color: #2d2d42;
        padding: 4px 8px;
    }

        select option:checked {
            background-color: rgba(184,137,46,.08);
            color: #2d2d42;
        }

    select optgroup {
        background-color: #f4f1ec;
        color: #9e9eb0;
        font-weight: 700;
    }

        select optgroup option {
            background-color: #fffefa;
            color: #2d2d42;
            font-weight: 400;
        }

.rpt-select option {
    background-color: #fffefa;
    color: #2d2d42;
}

.rpt-select optgroup {
    background-color: #f4f1ec;
    color: #9e9eb0;
}
