/*
 * RentalAjay - Dark Mode Contrast Hardening V4
 * ------------------------------------------------------------
 * Lapisan terakhir untuk komponen lama yang masih memakai
 * background terang / warna teks statis ketika tema gelap aktif.
 * Dibuat spesifik ke data-theme="dark" agar light mode tidak berubah.
 */

html[data-theme="dark"] {
    color-scheme: dark;
}

/* ------------------------------------------------------------
   1. Rental Terdekat / Lokasi toko
   ------------------------------------------------------------ */
html[data-theme="dark"] :is(
    .rp-nearby-hero,
    .rp-nearby-filter,
    .rp-nearby-store-card,
    .rp-nearby-empty,
    .rp-location-form-card,
    .rp-location-public-toggle,
    .rp-location-preview
) {
    color: #eef4ff !important;
    background: #111b2d !important;
    border-color: #2b3b55 !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.22) !important;
}

html[data-theme="dark"] .rp-nearby-hero {
    background:
        radial-gradient(circle at 100% 0%, rgba(67,97,238,.18), transparent 42%),
        linear-gradient(135deg, #111b2d, #13213a) !important;
}

html[data-theme="dark"] :is(
    .rp-nearby-hero h1,
    .rp-nearby-results-head h2,
    .rp-nearby-store-top h3,
    .rp-nearby-empty h2,
    .rp-location-heading h2,
    .rp-location-public-toggle strong,
    .rp-navigation-button-text strong
) {
    color: #f4f7ff !important;
}

html[data-theme="dark"] :is(
    .rp-nearby-hero p,
    .rp-nearby-results-head p,
    .rp-nearby-results-head > span,
    .rp-nearby-address,
    .rp-nearby-empty p,
    .rp-location-heading p,
    .rp-location-status,
    .rp-location-public-toggle small,
    .rp-navigation-button-text small,
    .rp-location-preview-help
) {
    color: #aebbd0 !important;
}

html[data-theme="dark"] .rp-location-kicker,
html[data-theme="dark"] .rp-nearby-distance {
    color: #8fb0ff !important;
}

html[data-theme="dark"] .rp-nearby-hero-icon,
html[data-theme="dark"] .rp-location-pin,
html[data-theme="dark"] .rp-location-preview-icon {
    color: #a9c1ff !important;
    background: #182947 !important;
    border-color: #304665 !important;
}

html[data-theme="dark"] .rp-nearby-product-count,
html[data-theme="dark"] .rp-nearby-categories span {
    color: #c7d6ff !important;
    background: #182947 !important;
    border-color: #304665 !important;
}

html[data-theme="dark"] .rp-store-map-button,
html[data-theme="dark"] .rp-navigation-button {
    color: #a9c1ff !important;
    background: #18243a !important;
    border-color: #30415e !important;
}

html[data-theme="dark"] .rp-store-direction-button {
    color: #86efac !important;
    background: #123226 !important;
    border-color: #256947 !important;
}

/* ------------------------------------------------------------
   2. Marketplace, katalog, toko, following
   ------------------------------------------------------------ */
html[data-theme="dark"] :is(
    .market-card,
    .market-filter-card,
    .market-toolbar,
    .store-profile-card,
    .following-card,
    .store-seller-panel,
    .store-admin-preview,
    .store-metric-row > div,
    .search-panel
) {
    color: #eef4ff !important;
    background: #111b2d !important;
    border-color: #2b3b55 !important;
}

html[data-theme="dark"] .market-card-image-link {
    background: #0d1728 !important;
}

html[data-theme="dark"] :is(
    .market-card-title,
    .store-profile-main h3,
    .following-card h3,
    .store-seller-info h2,
    .store-preview-identity h3,
    .store-metric-row strong,
    .store-mini-copy strong
) {
    color: #f2f6ff !important;
}

html[data-theme="dark"] :is(
    .market-card-category,
    .market-card-price small,
    .store-profile-main p,
    .following-card-description,
    .following-card-stats span,
    .store-seller-info p,
    .store-preview-identity p,
    .store-metric-row span,
    .store-mini-copy span
) {
    color: #aebbd0 !important;
}

html[data-theme="dark"] .store-section-kicker,
html[data-theme="dark"] .market-stock {
    color: #b8c9ff !important;
    background: #182947 !important;
}

html[data-theme="dark"] .store-follow-button {
    color: #dce7ff !important;
    background: #18243a !important;
    border-color: #30415e !important;
}

/* ------------------------------------------------------------
   3. Login / register / social auth
   ------------------------------------------------------------ */
html[data-theme="dark"] :is(
    .social-auth-grid > .card,
    .social-security-note,
    .provider-register-box,
    .oauth-linked-account,
    .register-provider-card,
    .register-category-card
) {
    color: #eef4ff !important;
    background: #111b2d !important;
    border-color: #2b3b55 !important;
}

html[data-theme="dark"] :is(
    .social-auth-heading h1,
    .social-section-title h2,
    .register-provider-shell .auth-head h1,
    .register-category-content > span
) {
    color: #f4f7ff !important;
}

html[data-theme="dark"] :is(
    .social-section-title p,
    .social-security-note,
    .register-provider-shell .auth-head p,
    .register-category-description
) {
    color: #aebbd0 !important;
}

html[data-theme="dark"] .register-category-card:hover,
html[data-theme="dark"] .register-category-card:has(.register-category-checkbox:checked) {
    background: #162744 !important;
    border-color: #5579e8 !important;
}

/* Google button sengaja tetap terang, tetapi teks dipaksa gelap. */
html[data-theme="dark"] .social-btn-google {
    color: #172033 !important;
    background: #ffffff !important;
    border-color: #d8e0ed !important;
}

/* ------------------------------------------------------------
   4. Dashboard customer + order + detail produk
   ------------------------------------------------------------ */
html[data-theme="dark"] :is(
    .customer-panel,
    .customer-stat-card,
    .customer-next-panel,
    .customer-next-booking,
    .customer-status-item,
    .customer-recent-card,
    .customer-mobile-order-card,
    .customer-mobile-order-period,
    .product-detail-card,
    .item-booking-card,
    .spec-list,
    .ops-calendar-disclosure-body
) {
    color: #eef4ff !important;
    background: #111b2d !important;
    border-color: #2b3b55 !important;
}

html[data-theme="dark"] :is(
    .customer-panel h2,
    .customer-panel h3,
    .customer-next-code,
    .customer-money-value,
    .product-detail-card h1,
    .product-detail-card h2,
    .item-booking-card h2,
    .spec strong
) {
    color: #f4f7ff !important;
}

html[data-theme="dark"] :is(
    .customer-panel-kicker,
    .customer-next-date,
    .customer-next-meta,
    .customer-mobile-order-label,
    .product-detail-description,
    .item-booking-intro,
    .spec span
) {
    color: #aebbd0 !important;
}

/* ------------------------------------------------------------
   5. Seller Center / admin
   ------------------------------------------------------------ */
html[data-theme="dark"] body.admin-body :is(
    .admin-panel,
    .admin-dashboard-card,
    .admin-stat-card,
    .admin-stock-item,
    .admin-quick-actions,
    .admin-quick-actions a,
    .card,
    .summary-box
) {
    color: #eef4ff !important;
    background: #111b2d !important;
    border-color: #2b3b55 !important;
}

html[data-theme="dark"] body.admin-body :is(
    .admin-panel h1,
    .admin-panel h2,
    .admin-panel h3,
    .admin-dashboard-card h2,
    .admin-stock-item strong,
    .stat-value
) {
    color: #f4f7ff !important;
}

html[data-theme="dark"] body.admin-body :is(
    .admin-footer,
    .admin-panel p,
    .admin-stock-item small,
    .stat-label
) {
    color: #aebbd0 !important;
}

html[data-theme="dark"] body.admin-body .admin-quick-actions {
    border-color: #2b3b55 !important;
}

html[data-theme="dark"] body.admin-body .admin-table th {
    color: #b9c7d9 !important;
    background: #142034 !important;
}

html[data-theme="dark"] body.admin-body .admin-table tbody tr:hover {
    background: #142034 !important;
}

/* ------------------------------------------------------------
   6. Subscription + TriPay + legal/support
   ------------------------------------------------------------ */
html[data-theme="dark"] :is(
    .subscription-price-card,
    .tripay-invoice-card,
    .tripay-checkout-panel,
    .tripay-sample-box,
    .tripay-payment-method-line,
    .legal-card,
    .legal-document,
    .legal-steps > div,
    .support-topic-grid > div
) {
    color: #eef4ff !important;
    background: #111b2d !important;
    border-color: #2b3b55 !important;
}

html[data-theme="dark"] :is(
    .legal-hero h1,
    .legal-card h2,
    .legal-card h3,
    .legal-document h2,
    .support-topic-grid h3
) {
    color: #f4f7ff !important;
}

html[data-theme="dark"] :is(
    .legal-hero p,
    .legal-card p,
    .legal-document p,
    .support-topic-grid p,
    .tripay-payment-method-line small
) {
    color: #aebbd0 !important;
}

/* Metode pembayaran dinamis TriPay. */
html[data-theme="dark"] :is(
    .tripay-method-card,
    .tripay-payment-method-card,
    .tripay-method-picker,
    .tripay-method-selected,
    .tripay-method-options,
    .tripay-method-option
) {
    color: #eef4ff !important;
    background: #111b2d !important;
    border-color: #2b3b55 !important;
}

html[data-theme="dark"] :is(
    .tripay-method-card:hover,
    .tripay-payment-method-card:hover,
    .tripay-method-option:hover,
    .tripay-method-card.is-selected,
    .tripay-payment-method-card.is-selected
) {
    background: #162744 !important;
    border-color: #5579e8 !important;
}

/* ------------------------------------------------------------
   7. Rating/review dan chat
   ------------------------------------------------------------ */
html[data-theme="dark"] :is(
    .rp-public-review-block,
    .rp-public-review-card,
    .rp-review-card,
    .rp-review-form-card,
    .rp-review-summary,
    .rp-review-empty,
    .rp-seller-review-card,
    .rp-seller-rating-summary,
    .rp-chat-list-panel,
    .rp-chat-thread-panel,
    .rp-chat-thread-header,
    .rp-chat-compose,
    .rp-chat-conversation,
    .rp-chat-welcome
) {
    color: #eef4ff !important;
    background: #111b2d !important;
    border-color: #2b3b55 !important;
}

html[data-theme="dark"] :is(
    .rp-public-review-card h3,
    .rp-review-card h2,
    .rp-review-card h3,
    .rp-seller-review-card h3,
    .rp-chat-list-heading h1,
    .rp-chat-welcome h2,
    .rp-chat-thread-header strong
) {
    color: #f4f7ff !important;
}

html[data-theme="dark"] :is(
    .rp-public-review-card small,
    .rp-public-review-title p,
    .rp-review-card small,
    .rp-seller-review-card p,
    .rp-chat-list-bottom,
    .rp-chat-list-top time,
    .rp-chat-welcome p,
    .rp-chat-thread-header > div > span
) {
    color: #aebbd0 !important;
}

/* ------------------------------------------------------------
   8. Rental Flow / kalender / komponen kondisi
   ------------------------------------------------------------ */
html[data-theme="dark"] :is(
    .rf-card,
    .rf-calendar-card,
    .rf-progress,
    .rf-progress-step,
    .rf-product-row,
    .rf-event,
    .rf-report,
    .rf-photo-preview,
    .rf-scan-confirm
) {
    color: #eef4ff !important;
    background: #111b2d !important;
    border-color: #2b3b55 !important;
}

html[data-theme="dark"] :is(
    .rf-card h2,
    .rf-calendar-head h2,
    .rf-scan-confirm h2,
    .rf-product-row strong,
    .rf-report-head strong
) {
    color: #f4f7ff !important;
}

html[data-theme="dark"] :is(
    .rf-card p,
    .rf-product-row small,
    .rf-event small,
    .rf-report-head small,
    .rf-scan-confirm p
) {
    color: #aebbd0 !important;
}

/* ------------------------------------------------------------
   9. Form, tabel, helper text, empty state
   ------------------------------------------------------------ */
html[data-theme="dark"] :is(
    .empty-state,
    .customer-empty-mini,
    .customer-mobile-order-empty
) {
    color: #b8c5d8 !important;
}

html[data-theme="dark"] :is(
    .form-label,
    label,
    legend
) {
    color: #dce6f5 !important;
}

html[data-theme="dark"] :is(
    .muted,
    .small,
    small,
    .help-text,
    .form-text
) {
    color: #aebbd0 !important;
}

html[data-theme="dark"] :is(input, select, textarea, .form-control, .form-select) {
    color: #eef4ff !important;
    background: #0f192a !important;
    border-color: #33445f !important;
}

html[data-theme="dark"] :is(input, textarea)::placeholder {
    color: #8190a6 !important;
    opacity: 1;
}

html[data-theme="dark"] table td {
    color: #e6edf8;
}

html[data-theme="dark"] .table-wrap {
    border-color: #2b3b55 !important;
}

/* ------------------------------------------------------------
   10. Mobile: jaga kontras tanpa membuat halaman terlalu terang
   ------------------------------------------------------------ */
@media (max-width: 780px) {
    html[data-theme="dark"] .rp-nearby-hero {
        box-shadow: none !important;
    }

    html[data-theme="dark"] :is(
        .rp-nearby-filter,
        .rp-nearby-store-card,
        .customer-panel,
        .customer-mobile-order-card,
        .register-provider-card,
        .subscription-price-card
    ) {
        box-shadow: none !important;
    }
}
