/* لوحة التحكم الرئيسية والقائمة الجانبية (شكلها من Dashboard with Collapsible Sidebar في 21st.dev) */

/* ==========================================================
   لوحة اليوم (App\Filament\Widgets\TodayDashboard)
========================================================== */

.cp-dash {
    --cp-card-border: var(--lv-divider, #e5e7eb);
    --cp-green-bg: #e8f5e9;   --cp-green-fg: #2e7d32;
    --cp-blue-bg: #e3f2fd;    --cp-blue-fg: #1565c0;
    --cp-purple-bg: #f3e5f5;  --cp-purple-fg: #7b1fa2;
    --cp-orange-bg: #fff3e0;  --cp-orange-fg: #e65100;
    --cp-red-bg: #ffebee;     --cp-red-fg: #c62828;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.dark .cp-dash {
    --cp-green-bg: rgb(76 175 80 / 0.15);   --cp-green-fg: #81c784;
    --cp-blue-bg: rgb(33 150 243 / 0.15);   --cp-blue-fg: #90caf9;
    --cp-purple-bg: rgb(156 39 176 / 0.18); --cp-purple-fg: #ce93d8;
    --cp-orange-bg: rgb(255 152 0 / 0.15);  --cp-orange-fg: #ffb74d;
    --cp-red-bg: rgb(244 67 54 / 0.15);     --cp-red-fg: #ef9a9a;
}

.cp-dash-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.cp-dash-title {
    margin: 0;
    color: var(--lv-text);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
}
.cp-dash-sub {
    margin: 4px 0 0;
    color: var(--lv-muted);
    font-size: 0.9rem;
}
.cp-dash-logo {
    width: 6rem;
    height: 6.5rem;
    flex: none;
    object-fit: cover;
    object-position: 49% 0;
}

.cp-dash-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}
.cp-dash-card,
.cp-dash-panel {
    position: relative;
    padding: 20px;
    border: 1px solid var(--cp-card-border);
    border-radius: 14px;
    background: var(--lv-surface);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
    transition: box-shadow 0.2s ease;
}
.cp-dash-card:hover { box-shadow: 0 6px 18px -6px rgb(0 0 0 / 0.15); }
.cp-dash-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.cp-dash-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 10px;
}
.cp-dash-icon .fi-icon { width: 20px; height: 20px; }
.cp-dash-icon-sm { width: 34px; height: 34px; border-radius: 9px; }
.cp-dash-icon-sm .fi-icon { width: 16px; height: 16px; }
.cp-tone-green { background: var(--cp-green-bg); color: var(--cp-green-fg); }
.cp-tone-blue { background: var(--cp-blue-bg); color: var(--cp-blue-fg); }
.cp-tone-purple { background: var(--cp-purple-bg); color: var(--cp-purple-fg); }
.cp-tone-orange { background: var(--cp-orange-bg); color: var(--cp-orange-fg); }
.cp-tone-red { background: var(--cp-red-bg); color: var(--cp-red-fg); }
.cp-dash-trend .fi-icon { width: 18px; height: 18px; }
.cp-up { color: var(--cp-green-fg); }
.cp-down { color: var(--cp-red-fg); }
.cp-dash-card-label {
    margin-bottom: 4px;
    color: var(--lv-muted);
    font-size: 0.9rem;
    font-weight: 500;
}
.cp-dash-card-value {
    color: var(--lv-text);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.3;
}
.cp-dash-card-value small {
    color: var(--lv-muted);
    font-size: 0.8rem;
    font-weight: 500;
}
.cp-dash-card-note {
    margin-top: 6px;
    color: var(--lv-muted);
    font-size: 0.8rem;
}
.cp-dash-card-note span { font-weight: 600; }
.cp-dash-card-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--cp-orange-bg);
    color: var(--cp-orange-fg);
    font-size: 0.75rem;
    font-weight: 600;
}

.cp-dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.cp-dash-side {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.cp-dash-panel h3 {
    margin: 0 0 16px;
    color: var(--lv-text);
    font-size: 1.05rem;
    font-weight: 600;
}
.cp-dash-panel h3.cp-dash-subhead { margin-top: 24px; }
.cp-dash-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.cp-dash-panel-head h3 { margin: 0; }
.cp-dash-link {
    color: var(--lv-green, #2e7d32);
    font-size: 0.85rem;
    font-weight: 600;
}
.cp-dash-link:hover { text-decoration: underline; }

.cp-dash-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px;
    border-radius: 10px;
    transition: background-color 0.15s ease;
}
.cp-dash-row:hover { background: var(--lv-hover); }
.cp-dash-row-text { flex: 1; min-width: 0; }
.cp-dash-row-title,
.cp-dash-row-desc {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cp-dash-row-title { color: var(--lv-text); font-size: 0.9rem; font-weight: 500; }
.cp-dash-row-desc { color: var(--lv-muted); font-size: 0.78rem; }
.cp-dash-row-end {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: none;
}
.cp-dash-row-amount { color: var(--lv-text); font-size: 0.85rem; font-weight: 600; }
.cp-dash-row-time { color: var(--lv-muted); font-size: 0.72rem; }

.cp-dash-bar-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    color: var(--lv-text-2, var(--lv-text));
    font-size: 0.85rem;
}
.cp-dash-bar-row span:last-child { color: var(--lv-text); font-weight: 600; }
.cp-dash-bar {
    height: 8px;
    margin-top: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--lv-divider, #e5e7eb);
}
.cp-dash-bar > div {
    height: 100%;
    border-radius: 999px;
    background: var(--lv-green, #43a047);
    transition: width 0.6s ease;
}
.cp-dash-bar-alt > div { background: #fb8c00; }

.cp-dash-product {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.cp-dash-product + .cp-dash-product { border-top: 1px solid var(--cp-card-border); }
.cp-dash-rank {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 50%;
    background: var(--lv-hover);
    color: var(--lv-muted);
    font-size: 0.75rem;
    font-weight: 600;
}
.cp-dash-product img {
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 8px;
    object-fit: cover;
}
.cp-dash-product-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--lv-text);
    font-size: 0.85rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cp-dash-product-num { flex: none; color: var(--lv-text); font-size: 0.8rem; font-weight: 600; }
.cp-dash-empty { margin: 8px 0; color: var(--lv-muted); font-size: 0.85rem; }

@media (max-width: 1279px) {
    .cp-dash-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cp-dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .cp-dash { gap: 16px; }
    .cp-dash-title { font-size: 1.35rem; }
    .cp-dash-logo { display: none; }
    .cp-dash-cards { gap: 12px; }
    .cp-dash-card { padding: 14px; }
    .cp-dash-card-value { font-size: 1.25rem; }
    .cp-dash-card-top { margin-bottom: 10px; }
}

/* جداول الصفحة الرئيسية (مبيعات أمس والإقامات والوثائق) بنفس شكل البطاقات اللي فوق */
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-ctn {
    border: 1px solid var(--lv-divider, #e5e7eb);
    border-radius: 14px;
    background: var(--lv-surface);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
    transition: box-shadow 0.2s ease;
}
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-ctn:hover { box-shadow: 0 6px 18px -6px rgb(0 0 0 / 0.15); }
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-header {
    padding: 20px 20px 12px;
    border-bottom: 0;
}
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-header-heading {
    color: var(--lv-text);
    font-size: 1.05rem;
    font-weight: 600;
}
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-content-ctn {
    padding: 0 12px 12px;
    border-top: 0;
}
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table {
    border-collapse: separate;
    border-spacing: 0;
}
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table thead th {
    background: var(--lv-hover);
    color: var(--lv-muted);
    font-size: 0.8rem;
    font-weight: 500;
}
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table thead th:first-child { border-start-start-radius: 10px; border-end-start-radius: 10px; }
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table thead th:last-child { border-start-end-radius: 10px; border-end-end-radius: 10px; }
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table tbody tr,
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table tbody tr.fi-striped {
    background: transparent;
}
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table tbody td { border-bottom: 1px solid var(--lv-divider, #e5e7eb); }
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table tbody tr:last-child td { border-bottom: 0; }
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table tbody tr:hover td { background: var(--lv-hover); }
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table tbody tr,
.fi-page:has(.cp-dash) .fi-wi-table .fi-ta-table thead tr { border: 0; }
.fi-page:has(.cp-dash) .fi-wi-table .fi-badge { border-radius: 999px; }

/* ==========================================================
   القائمة الجانبية: العنصر المختار يتلون ومعه خط، وزوايا مدورة
========================================================== */

@media (min-width: 1024px) {
    .fi-sidebar.fi-sidebar-open .fi-sidebar-group-items { padding-inline: 8px; }
}
.fi-sidebar-open .fi-sidebar-item-btn:has(> .fi-sidebar-item-grouped-border) {
    position: relative;
    border-radius: 10px;
    padding-inline-start: 64px;
}
.fi-sidebar-item-btn { position: relative; }
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn,
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn:hover {
    background: color-mix(in srgb, var(--lv-green, #43a047) 12%, transparent);
}
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    inset-inline-start: 0;
    width: 3px;
    border-radius: 3px;
    background: var(--lv-green, #43a047);
}
/* أرقام التنبيه جنب العنصر */
.fi-sidebar-item-btn .fi-badge {
    min-width: 22px;
    justify-content: center;
    border-radius: 999px;
    font-weight: 600;
}
