/**
 * Custom Filament Dashboard Styles
 */

/* =================================
   Dashboard Layout
   ================================= */

/* Dashboard main content area */
.fi-page-content {
    display: flex;
    flex-direction: column;
    gap: 1rem !important;
}

/* Widget grid container */
.fi-wi {
    margin-bottom: 0 !important;
}

/* Section components (cards) */
.fi-section {
    margin-bottom: 0 !important;
}

/* Ensure proper spacing for all widgets */
[data-widget] {
    margin-bottom: 0 !important;
}

/* Grid schema components */
.fi-schemas-grid {
    gap: 1rem !important;
}

/* Fix for nested grid layouts */
.fi-schemas-grid > * {
    margin-bottom: 0 !important;
}

/* =================================
   Chart Containment
   ================================= */

.chart-container {
    position: relative !important;
    width: 100% !important;
    overflow: hidden !important;
}

.chart-container canvas {
    max-width: 100% !important;
    max-height: 100% !important;
}

.chart-container svg,
.fi-section-content > svg {
    max-width: 100% !important;
    max-height: 100% !important;
}

/* =================================
   Pagination
   ================================= */

/* Fix pagination icons size */
nav[role="navigation"] svg,
.pagination svg,
[aria-label*="Pagination"] svg {
    width: 1rem !important;
    height: 1rem !important;
    flex-shrink: 0;
}

/* Ensure all heroicons have proper sizing */
.fi-icon-btn svg,
.fi-ac-icon svg,
button svg:not(.chart-container svg) {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* =================================
   Dashboard Stats
   ================================= */

/* Individual stat - card style */
.fi-wi-stats-overview-stat {
    padding: 1rem !important;
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05) !important;
}

.dark .fi-wi-stats-overview-stat {
    background: rgb(31 41 55) !important;
    border-color: rgb(55 65 81) !important;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3) !important;
}

/* Stat label */
.fi-wi-stats-overview-stat-label {
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    color: #6b7280 !important;
}

.dark .fi-wi-stats-overview-stat-label {
    color: #9ca3af !important;
}

/* Stat value */
.fi-wi-stats-overview-stat-value {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    color: #111827 !important;
}

.dark .fi-wi-stats-overview-stat-value {
    color: #f9fafb !important;
}

/* Stat description */
.fi-wi-stats-overview-stat-description {
    font-size: 0.75rem !important;
}

/* Section cards */
.fi-section {
    border: 1px solid #e5e7eb !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1) !important;
}

.dark .fi-section {
    border-color: rgb(55 65 81) !important;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3) !important;
}

.fi-section-content {
    padding: 1rem !important;
}

/* Stats widget - remove outer card */
.fi-wi-stats-overview .fi-section {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.fi-wi-stats-overview .fi-section-content {
    padding: 0 !important;
}

/* Table card */
.fi-ta {
    border: 1px solid #e5e7eb !important;
    border-radius: 0.75rem !important;
}

.dark .fi-ta {
    border-color: rgb(55 65 81) !important;
}

/* Table row hover - dark mode fix */
.dark .fi-ta-row:hover > .fi-ta-cell {
    background: rgb(55 65 81) !important;
}

/* Table header - dark mode fix */
.dark .fi-ta-header-cell {
    background: rgb(31 41 55) !important;
}

/* =================================
   Thai Text Word Breaking Fix
   ================================= */

/* Prevent Thai text from breaking in the middle of words */
.fi-in-text,
.fi-in-entry,
.fi-ta-cell,
.fi-section-content {
    word-break: keep-all !important;
    overflow-wrap: break-word !important;
}

/* Infolist text entries - allow natural word wrap */
.fi-in-text-item,
.fi-in-text-item-value {
    word-break: keep-all !important;
    overflow-wrap: break-word !important;
    hyphens: none !important;
}

/* Table cells - prevent word breaking */
.fi-ta-text,
.fi-ta-text-item {
    word-break: keep-all !important;
    overflow-wrap: break-word !important;
}

/* Labels should not break */
.fi-in-entry-wrp > dt,
.fi-fo-field-wrp > label {
    white-space: nowrap !important;
}

/* Specific fix for Thai campaign names and long text */
.fi-in-text-item-value p,
.fi-ta-text-item p {
    word-break: keep-all !important;
    line-height: 1.5 !important;
}

/* =================================
   Navigation Icon Colors
   ================================= */

/* การจัดการกิจกรรม Group */
a[href*="/admin/events"] svg.fi-sidebar-item-icon {
    color: rgb(59, 130, 246) !important; /* blue */
}

a[href*="/admin/registrations"] svg.fi-sidebar-item-icon {
    color: rgb(16, 185, 129) !important; /* green */
}

a[href*="/admin/surveys"] svg.fi-sidebar-item-icon {
    color: rgb(139, 92, 246) !important; /* violet */
}

a[href*="/admin/marketing-source-report"] svg.fi-sidebar-item-icon {
    color: rgb(99, 102, 241) !important; /* indigo */
}

a[href*="/admin/registration-report"] svg.fi-sidebar-item-icon {
    color: rgb(20, 184, 166) !important; /* teal */
}

/* การจัดการสมาชิก Group */
a[href*="/admin/members"]:not([href*="/member-types"]) svg.fi-sidebar-item-icon {
    color: rgb(59, 130, 246) !important; /* blue */
}

a[href*="/admin/member-types"] svg.fi-sidebar-item-icon {
    color: rgb(245, 158, 11) !important; /* amber */
}

/* บัญชีและรายงาน Group */
a[href*="/admin/account-categories"] svg.fi-sidebar-item-icon {
    color: rgb(156, 163, 175) !important; /* gray */
}

a[href*="/admin/journal-entries"] svg.fi-sidebar-item-icon {
    color: rgb(245, 158, 11) !important; /* amber */
}

a[href*="/admin/income-expense-report"] svg.fi-sidebar-item-icon {
    color: rgb(16, 185, 129) !important; /* emerald */
}

a[href*="/admin/vat-report"] svg.fi-sidebar-item-icon {
    color: rgb(132, 204, 22) !important; /* lime */
}

a[href*="/admin/withholding-tax-report"] svg.fi-sidebar-item-icon {
    color: rgb(217, 70, 239) !important; /* fuchsia */
}

/* การเงิน Group */
a[href*="/admin/invoices"] svg.fi-sidebar-item-icon {
    color: rgb(239, 68, 68) !important; /* red */
}

a[href*="/admin/receipts"]:not([href*="/slip"]) svg.fi-sidebar-item-icon {
    color: rgb(244, 63, 94) !important; /* rose */
}

a[href*="/admin/slip-verification"] svg.fi-sidebar-item-icon {
    color: rgb(236, 72, 153) !important; /* pink */
}

a[href*="/admin/outstanding-invoice-report"] svg.fi-sidebar-item-icon {
    color: rgb(239, 68, 68) !important; /* red */
}

/* การแจ้งเตือน Group */
a[href*="/admin/notification-logs"] svg.fi-sidebar-item-icon {
    color: rgb(251, 146, 60) !important; /* orange */
}

/* การตั้งค่าระบบ Group */
a[href*="/admin/shield/roles"] svg.fi-sidebar-item-icon {
    color: rgb(168, 85, 247) !important; /* purple */
}

a[href*="/admin/users"] svg.fi-sidebar-item-icon {
    color: rgb(59, 130, 246) !important; /* blue */
}

a[href*="/admin/activity-logs"] svg.fi-sidebar-item-icon {
    color: rgb(245, 158, 11) !important; /* amber */
}

a[href*="/admin/bank-accounts"] svg.fi-sidebar-item-icon {
    color: rgb(16, 185, 129) !important; /* green */
}

a[href*="/admin/payment-settings"] svg.fi-sidebar-item-icon {
    color: rgb(14, 165, 233) !important; /* sky */
}

a[href*="/admin/email-templates"] svg.fi-sidebar-item-icon {
    color: rgb(6, 182, 212) !important; /* cyan */
}
