<?php
/**
 * includes/admin/admin-wd-styles.php
 *
 * [1.6.118.123] CSS partilhado das classes rmbz-wd-* (design moderno do
 * admin). Estava embutido na página de Levantamentos; extraído para aqui
 * para poder ser reutilizado noutras páginas (ex: Cupões). Imprime o bloco
 * <style> uma única vez por request (flag estática).
 */

if ( ! defined( 'ABSPATH' ) ) { exit; }

function rmbz_admin_wd_styles() {
    static $done = false;
    if ( $done ) { return; }
    $done = true;
    ?>
        <style>
            /* [1.6.118.18] REFACTOR VISUAL — light theme moderno
             * Classes novas: rmbz-wd-* (consistente com Gestão/Perfil/Depósitos).
             * Legacy CSS preservado abaixo para modal e outros usos.
             */
            .rmbz-withdrawals-modern.rmbz-admin-wrap {
                max-width: none;
                margin: 16px 20px 32px 0;
                font-family: "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;
                color: #1a1a1f;
                background: transparent;
                padding: 0;
            }

            /* Header */
            .rmbz-wd-head h1 { font-size: 26px; font-weight: 800; margin: 0 0 4px 0; color: #1d2327; letter-spacing: -0.01em; }
            .rmbz-wd-head p  { margin: 0; color: #5f6368; font-size: 13px; }

            /* Stats grid */
            .rmbz-wd-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 20px 0 18px; }
            .rmbz-wd-stat-card { background: #fff; border: 1px solid #e1e4e8; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
            .rmbz-wd-stat-card .label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #5f6368; letter-spacing: 0.5px; margin-bottom: 6px; }
            .rmbz-wd-stat-card .value { font-size: 26px; font-weight: 800; color: #1d2327; line-height: 1.1; }
            .rmbz-wd-stat-card .sub   { font-size: 11px; color: #5f6368; margin-top: 3px; font-weight: 500; }
            .rmbz-wd-stat-card.warn .value    { color: #9a3412; }
            .rmbz-wd-stat-card.info .value    { color: #1e40af; }
            .rmbz-wd-stat-card.success .value { color: #047857; }
            .rmbz-wd-stat-card.danger .value  { color: #b91c1c; }

            /* Toolbar */
            .rmbz-wd-toolbar { background: #fff; border: 1px solid #e1e4e8; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
            .rmbz-wd-search { display: flex; gap: 8px; flex: 1; min-width: 240px; }
            .rmbz-wd-search-input { flex: 1; padding: 8px 12px; border: 1px solid #d8dae0; border-radius: 6px; font-size: 13px; }
            .rmbz-wd-filter-group { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
            .rmbz-wd-filter-label { font-size: 11px; color: #5f6368; text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; margin-right: 4px; }
            .rmbz-wd-chip { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 16px; background: #f1f3f5; color: #3c434a; font-size: 12px; font-weight: 600; text-decoration: none; border: 1px solid transparent; transition: 0.15s; }
            .rmbz-wd-chip:hover { background: #e9ecef; color: #1d2327; }
            .rmbz-wd-chip.active { background: #1d2327; color: #f0b90b; border-color: #1d2327; }
            .rmbz-wd-chip.active:hover { background: #1d2327; color: #f0b90b; }

            /* Botões */
            .rmbz-wd-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; background: #1d2327; color: #f0b90b; border: none; border-radius: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; text-decoration: none; transition: 0.15s; }
            .rmbz-wd-btn:hover { background: #2c2c34; color: #f0b90b; transform: translateY(-1px); }
            .rmbz-wd-btn.small { padding: 6px 10px; font-size: 11px; }
            .rmbz-wd-btn.ghost { background: #f1f3f5; color: #3c434a; }
            .rmbz-wd-btn.ghost:hover { background: #e9ecef; color: #1d2327; }
            .rmbz-wd-btn.success { background: #10b981; color: #fff; }
            .rmbz-wd-btn.success:hover { background: #047857; color: #fff; }
            .rmbz-wd-btn.danger { background: #ef4444; color: #fff; }
            .rmbz-wd-btn.danger:hover { background: #b91c1c; color: #fff; }
            .rmbz-wd-btn.info { background: #3b82f6; color: #fff; }
            .rmbz-wd-btn.info:hover { background: #1e40af; color: #fff; }
            .rmbz-wd-btn.disabled { background: #d1d5db; color: #6b7280; cursor: not-allowed; opacity: 0.7; }
            .rmbz-wd-btn.disabled:hover { background: #d1d5db; color: #6b7280; transform: none; }

            /* Sections */
            .rmbz-wd-section { background: #fff; border: 1px solid #e1e4e8; border-radius: 12px; padding: 0; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); overflow: hidden; }
            .rmbz-wd-section-title { font-size: 14px; font-weight: 700; text-transform: uppercase; color: #1d2327; letter-spacing: 0.3px; margin: 0; padding: 16px 20px; background: #f7f7fb; border-bottom: 1px solid #e1e4e8; display: flex; align-items: center; gap: 10px; }
            .rmbz-wd-section-count { display: inline-block; padding: 2px 9px; background: #1d2327; color: #f0b90b; border-radius: 12px; font-size: 11px; font-weight: 700; }

            /* Sub-tabs */
            .rmbz-wd-subtabs { display: flex; gap: 2px; padding: 0 20px; background: #fafafa; border-bottom: 1px solid #e1e4e8; }
            .rmbz-wd-subtabs a { padding: 10px 16px; text-decoration: none; color: #5f6368; font-weight: 600; font-size: 12px; border-bottom: 3px solid transparent; margin-bottom: -1px; transition: 0.15s; }
            .rmbz-wd-subtabs a:hover { color: #1d2327; }
            .rmbz-wd-subtabs a.active { color: #1d2327; border-bottom-color: #f0b90b; }

            /* Tabela */
            .rmbz-wd-table-wrap { overflow-x: auto; }
            .rmbz-wd-table { width: 100%; border-collapse: collapse; }
            .rmbz-wd-table thead th { background: #fafafa; padding: 10px 16px; text-align: left; font-size: 11px; text-transform: uppercase; font-weight: 700; color: #5f6368; letter-spacing: 0.5px; border-bottom: 1px solid #e1e4e8; }
            .rmbz-wd-table tbody td { padding: 14px 16px; border-bottom: 1px solid #f0f0f1; font-size: 13px; color: #3c434a; vertical-align: middle; }
            .rmbz-wd-table tbody tr:last-child td { border-bottom: none; }
            .rmbz-wd-table tbody tr:hover td { background: #fbfbfc; }

            /* Badges */
            .rmbz-wd-badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
            .rmbz-wd-badge.small { padding: 2px 7px; font-size: 10px; }
            .rmbz-wd-badge.wallet    { background: #d1ecf1; color: #0c5460; }
            .rmbz-wd-badge.royalties { background: #fff3cd; color: #856404; }

            .rmbz-wd-amount { color: #1e40af; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
            .rmbz-wd-method-badge { display: inline-block; padding: 3px 9px; background: #1d2327; color: #f0b90b; border-radius: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
            .rmbz-wd-account { margin-top: 4px; font-size: 13px; font-weight: 600; color: #1d2327; font-variant-numeric: tabular-nums; }

            /* Risco pill */
            .rmbz-wd-risk { display: inline-block; padding: 3px 9px; border-radius: 12px; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; }
            .rmbz-wd-risk.ok   { background: #10b981; }
            .rmbz-wd-risk.med  { background: #f59e0b; }
            .rmbz-wd-risk.hi   { background: #ef4444; }
            .rmbz-wd-risk.crit { background: #991b1b; box-shadow: 0 0 0 2px rgba(153, 27, 27, 0.2); }

            .rmbz-wd-checklist { margin-top: 4px; font-size: 11px; font-weight: 600; }
            .rmbz-wd-checklist.done    { color: #047857; }
            .rmbz-wd-checklist.pending { color: #5f6368; }

            /* Status pills histórico */
            .rmbz-wd-status { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
            .rmbz-wd-status.status-approved  { background: #d1fae5; color: #065f46; }
            .rmbz-wd-status.status-rejected  { background: #fee2e2; color: #991b1b; }
            .rmbz-wd-status.status-other     { background: #f1f3f5; color: #5f6368; }

            .rmbz-wd-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

            /* Empty state */
            .rmbz-wd-empty { padding: 50px 20px; text-align: center; color: #5f6368; }
            .rmbz-wd-empty .icon { font-size: 42px; margin-bottom: 10px; opacity: 0.4; }
            .rmbz-wd-empty .msg  { font-size: 14px; }

            /* Paginação */
            .rmbz-wd-pagination { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-top: 1px solid #f0f0f1; background: #fbfbfc; }
            .rmbz-wd-pagination .info { color: #5f6368; font-size: 12px; }
            .rmbz-wd-pagination .links { display: flex; gap: 4px; }
            .rmbz-wd-pagination .links a, .rmbz-wd-pagination .links span { padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; text-decoration: none; }
            .rmbz-wd-pagination .links a { background: #fff; color: #3c434a; border: 1px solid #e1e4e8; }
            .rmbz-wd-pagination .links a:hover { background: #1d2327; color: #f0b90b; border-color: #1d2327; }
            .rmbz-wd-pagination .links span.current { background: #1d2327; color: #f0b90b; border: 1px solid #1d2327; }
            .rmbz-wd-pagination .links span.dots { background: transparent; color: #aaa; border: none; }

            /* ========== LAYOUT LEGACY (mantido para modal) ========== */
            /* Hero — fundo escuro 1MZ + bloom dourado subtil */
            .rmbz-withdrawals-hero {
                background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 60%, #1f1f1f 100%);
                color: #fff;
                padding: 22px 26px;
                border-radius: 14px;
                margin-bottom: 22px;
                box-shadow: 0 4px 20px rgba(0,0,0,0.12);
                position: relative;
                overflow: hidden;
            }
            .rmbz-withdrawals-hero::before {
                content: '';
                position: absolute;
                top: -40%; right: -10%;
                width: 50%; height: 180%;
                background: radial-gradient(circle, rgba(240,185,11,0.18) 0%, transparent 60%);
                pointer-events: none;
            }
            .rmbz-withdrawals-hero > div { position: relative; z-index: 1; }
            .rmbz-withdrawals-hero h1 {
                color: #fff !important;
                font-size: 26px;
                margin: 0 0 4px 0;
            }
            .rmbz-withdrawals-hero p {
                color: rgba(255,255,255,0.72) !important;
                margin: 0;
                font-size: 14px;
            }
            .rmbz-withdrawals-hero p strong { color: #f0b90b; }

            /* Pills de sumário no topo direito (Pendentes / Aprovados / Rejeitados) */
            .rmbz-withdrawals-summary {
                display: flex; gap: 12px;
            }
            .rmbz-withdrawals-summary .rmbz-stat-pill {
                background: rgba(255,255,255,0.08);
                border: 1px solid rgba(240,185,11,0.25);
                border-radius: 10px;
                padding: 10px 18px;
                display: flex; flex-direction: column; align-items: center;
                min-width: 90px;
            }
            .rmbz-withdrawals-summary .stat-pending { border-color: rgba(240,185,11,0.45); }
            .rmbz-withdrawals-summary .stat-approved { border-color: rgba(46,204,113,0.45); }
            .rmbz-withdrawals-summary .stat-rejected { border-color: rgba(192,57,43,0.45); }
            .rmbz-withdrawals-summary .rmbz-stat-label {
                font-size: 10px; letter-spacing: 0.1em;
                text-transform: uppercase;
                color: rgba(255,255,255,0.6);
            }
            .rmbz-withdrawals-summary .rmbz-stat-value {
                font-size: 22px; font-weight: 800;
                line-height: 1.1; margin-top: 2px;
                color: #f0b90b;
            }
            .rmbz-withdrawals-summary .stat-approved .rmbz-stat-value { color: #2ecc71; }
            .rmbz-withdrawals-summary .stat-rejected .rmbz-stat-value { color: #e74c3c; }

            /* Card de pendentes: borda verde no topo (era inline antes) */
            .rmbz-withdrawals-modern .rmbz-withdrawals-pendentes {
                border-top: 4px solid #2ecc71;
            }

            /* Botão Ver Detalhe — classe dedicada (não depende do .btn-outline
             * que renderizava fantasma por causa de var() não definida no admin). */
            .rmbz-wd-view-btn {
                display: inline-flex;
                align-items: center; justify-content: center;
                padding: 7px 14px;
                border-radius: 8px;
                font-size: 12px;
                font-weight: 600;
                cursor: pointer;
                background: #1a1a1a;
                color: #f0b90b;
                border: 1px solid #f0b90b;
                transition: all 0.18s ease;
                white-space: nowrap;
            }
            .rmbz-wd-view-btn:hover {
                background: #f0b90b;
                color: #1a1a1a;
                transform: translateY(-1px);
                box-shadow: 0 3px 8px rgba(240,185,11,0.35);
            }

            /* ========== MODAL ========== */
            .rmbz-wd-modal {
                position: fixed; inset: 0; z-index: 100000;
                display: none; align-items: center; justify-content: center;
                padding: 20px;
            }
            .rmbz-wd-modal.is-open { display: flex; }
            .rmbz-wd-modal-backdrop {
                position: absolute; inset: 0;
                background: rgba(10,10,10,0.65);
                backdrop-filter: blur(2px);
            }
            .rmbz-wd-modal-dialog {
                position: relative;
                background: #fff;
                border-radius: 14px;
                box-shadow: 0 20px 60px rgba(0,0,0,0.4);
                max-width: 640px;
                width: 100%;
                max-height: 92vh;
                overflow: hidden;
                display: flex; flex-direction: column;
            }
            .rmbz-wd-modal-header {
                display: flex; justify-content: space-between; align-items: center;
                padding: 16px 22px;
                border-bottom: 1px solid #eee;
                background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
                color: #fff;
            }
            .rmbz-wd-modal-header h3 { margin: 0; font-size: 18px; color: #fff; }
            .rmbz-wd-modal-close {
                background: transparent; border: 0; color: #fff;
                font-size: 28px; cursor: pointer; line-height: 1;
                padding: 0 8px; opacity: 0.8;
            }
            .rmbz-wd-modal-close:hover { opacity: 1; }
            .rmbz-wd-modal-body { padding: 20px 22px; overflow-y: auto; }
            .rmbz-wd-modal-info {
                margin: 0;
                display: grid;
                grid-template-columns: 160px 1fr;
                gap: 6px 12px;
            }
            .rmbz-wd-modal-info dt {
                font-size: 12px; color: #666; font-weight: 600;
                text-transform: uppercase; letter-spacing: 0.04em;
            }
            .rmbz-wd-modal-info dd {
                margin: 0; font-size: 14px; color: #222;
                word-break: break-word;
            }
            .rmbz-wd-modal-info dd.amount {
                font-size: 18px; font-weight: 700; color: #2563eb;
            }
            .rmbz-wd-modal-info dd.status-aprovado {
                font-weight: 700; color: #10b981;
            }
            .rmbz-wd-modal-info dd.status-rejeitado {
                font-weight: 700; color: #6b7280;
            }
            .rmbz-wd-notes-block {
                margin-top: 20px;
                padding-top: 16px;
                border-top: 1px dashed #ddd;
            }
            .rmbz-wd-notes-block strong {
                display: block; margin-bottom: 6px;
                font-size: 12px; color: #666;
                text-transform: uppercase; letter-spacing: 0.04em;
            }
            .rmbz-wd-notes {
                margin: 0; padding: 10px 12px;
                background: #f7f7f7; border-radius: 8px;
                font-size: 13px; color: #333;
                white-space: pre-wrap;
            }
            .rmbz-wd-invoice-wrap {
                margin-top: 18px;
                padding-top: 16px;
                border-top: 1px dashed #ddd;
            }
            .rmbz-wd-invoice-btn {
                display: inline-flex;
                align-items: center; justify-content: center;
                padding: 11px 22px;
                background: #1a1a1a;
                color: #f0b90b;
                border: 1px solid #f0b90b;
                border-radius: 10px;
                font-size: 14px;
                font-weight: 600;
                text-decoration: none;
                transition: all 0.18s ease;
            }
            .rmbz-wd-invoice-btn:hover {
                background: #f0b90b;
                color: #1a1a1a;
                box-shadow: 0 3px 10px rgba(240,185,11,0.35);
            }
            @media (max-width: 720px) {
                .rmbz-withdrawals-hero {
                    flex-direction: column; gap: 14px; align-items: flex-start;
                }
                .rmbz-withdrawals-summary { width: 100%; }
                .rmbz-withdrawals-summary .rmbz-stat-pill { flex: 1; }
                .rmbz-wd-modal-info { grid-template-columns: 1fr; gap: 2px 0; }
                .rmbz-wd-modal-info dt { margin-top: 8px; }
            }
        </style>
    <?php
}
