/* 06-widgets.css — V5 color system, fp-toolbar, fp-badge,
   sort-link, table action buttons, stat tiles
   =========================================================== */

/* -----------------------------------------------------------
   21. V5 — More Color, Better Widgets
   ----------------------------------------------------------- */

/* Semantic aliases — mapped to proxy design token system */
:root {
    /* Green = success */
    --c-green:          var(--c-success);
    --c-green-bg:       var(--c-success-dim);
    --c-green-border:   var(--c-success-bdr);

    /* Amber = warning */
    --c-amber:          var(--c-warning);
    --c-amber-bg:       var(--c-warning-dim);
    --c-amber-border:   var(--c-warning-bdr);

    /* Red = danger */
    --c-red:            var(--c-danger);
    --c-red-bg:         var(--c-danger-dim);
    --c-red-border:     var(--c-danger-bdr);

    /* Teal */
    --c-teal:           #14b8a6;
    --c-teal-bg:        rgba(20, 184, 166, 0.08);
    --c-teal-border:    rgba(20, 184, 166, 0.22);

    /* Violet = purple */
    --c-violet:         var(--c-purple);
    --c-violet-bg:      var(--c-purple-dim);
    --c-violet-border:  rgba(167, 139, 250, 0.25);

    /* Rose */
    --c-rose:           #f43f5e;
    --c-rose-bg:        rgba(244, 63, 94, 0.08);
    --c-rose-border:    rgba(244, 63, 94, 0.22);
}

/* Card top-border accent modifiers */
.fp-card-accent-blue   { border-top: 2px solid var(--c-accent) !important; }
.fp-card-accent-green  { border-top: 2px solid var(--c-green) !important; }
.fp-card-accent-amber  { border-top: 2px solid var(--c-amber) !important; }
.fp-card-accent-red    { border-top: 2px solid var(--c-red) !important; }
.fp-card-accent-teal   { border-top: 2px solid var(--c-teal) !important; }
.fp-card-accent-violet { border-top: 2px solid var(--c-violet) !important; }

/* Card header icon tints */
.card-title .text-blue   { color: var(--c-accent-light) !important; }
.card-title .text-green  { color: #4ade80 !important; }
.card-title .text-amber  { color: #fbbf24 !important; }
.card-title .text-teal   { color: #2dd4bf !important; }
.card-title .text-violet { color: #a78bfa !important; }

/* === fp-toolbar — Pill button strip === */
.fp-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    row-gap: 0.4rem;
    padding: 0.25rem 0;
}

.fp-toolbar .btn {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3125rem 0.875rem;
    border-radius: 20px !important;
    letter-spacing: 0.02em;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.fp-toolbar .btn i {
    font-size: 0.875rem;
}

/* Toolbar separator */
.fp-toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--c-border);
    flex-shrink: 0;
    align-self: center;
    margin: 0 0.125rem;
}

/* Toolbar pill overrides — larger shadow radius to show on pill shape */
.fp-toolbar .btn-primary {
    box-shadow: 0 2px 10px rgba(var(--c-accent-rgb), 0.4),
                inset 0 1px 0 rgba(255,255,255,0.12);
}
.fp-toolbar .btn-primary:hover {
    box-shadow: 0 4px 14px rgba(var(--c-accent-rgb), 0.5);
}
.fp-toolbar .btn-danger {
    box-shadow: 0 2px 10px rgba(240, 64, 85, 0.35),
                inset 0 1px 0 rgba(255,255,255,0.1);
}
.fp-toolbar .btn-success {
    box-shadow: 0 2px 10px rgba(39, 201, 122, 0.35),
                inset 0 1px 0 rgba(255,255,255,0.1);
}
.fp-toolbar .btn-warning {
    box-shadow: 0 2px 10px rgba(245, 166, 35, 0.35),
                inset 0 1px 0 rgba(255,255,255,0.1);
}
/* Ghost toolbar pills */
.fp-toolbar .btn-secondary,
.fp-toolbar .btn-outline-secondary {
    background: transparent;
    border-color: var(--c-border-str);
    color: var(--c-text-muted);
}
.fp-toolbar .btn-secondary:hover,
.fp-toolbar .btn-outline-secondary:hover {
    background: var(--c-accent-dim);
    border-color: var(--c-accent-bdr);
    color: var(--c-accent-light);
    box-shadow: none;
}

/* Card-body toolbar wrapper */
.card-body.fp-toolbar-body {
    padding: 0.625rem 1rem;
    background: var(--c-elevated);
    border-bottom: 1px solid var(--c-border-subtle);
}
@media (max-width: 576px) {
    .card-body.fp-toolbar-body {
        padding: 0.5rem 0.75rem;
    }
    .fp-toolbar .btn {
        font-size: 0.6875rem;
        padding: 0.25rem 0.625rem;
    }
}

/* === Card header collapse button === */
.btn-icon-collapse {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    color: var(--c-text-subtle);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    padding: 0;
    font-size: 0.8125rem;
    flex-shrink: 0;
    line-height: 1;
}

.btn-icon-collapse:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--c-accent);
    color: var(--c-accent-light);
}

/* === Table row improvements === */
.table-row.selected td {
    background-color: rgba(6, 111, 209, 0.08) !important;
}

.table-row.selected td:first-child {
    border-left: 2px solid var(--c-accent);
}

.table tbody tr.table-row:hover td:first-child {
    border-left: 2px solid rgba(6, 111, 209, 0.35);
}

/* Sort links */
.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
    width: 100%;
}

.sort-link:hover {
    color: var(--c-accent-light);
    text-decoration: none;
}

.sort-indicator {
    color: var(--c-text-subtle);
    font-size: 0.6875rem;
    margin-left: auto;
}

.table-header-cell.sorted .sort-link {
    color: var(--c-accent-light);
}

.table-header-cell.sorted .sort-indicator {
    color: var(--c-accent-light);
}

/* Table action buttons */
.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.actions-cell .btn {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.1875rem 0.5625rem;
    letter-spacing: 0.02em;
    /* Override: no lift on tiny table buttons */
    transform: none !important;
    transition: background 0.12s ease, border-color 0.12s ease,
                box-shadow 0.12s ease, color 0.12s ease;
}

/* Ghost-by-default table action buttons */
.actions-cell .btn-warning {
    background: var(--c-warning-dim);
    border-color: var(--c-warning-bdr);
    color: var(--c-warning);
    box-shadow: none;
}
.actions-cell .btn-warning:hover {
    background: linear-gradient(180deg, #f9b84a 0%, var(--c-warning) 100%);
    border-color: var(--c-warning);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245, 166, 35, 0.4);
}

.actions-cell .btn-primary {
    background: var(--c-accent-dim);
    border-color: var(--c-accent-bdr);
    color: var(--c-accent-light);
    box-shadow: none;
}
.actions-cell .btn-primary:hover {
    background: linear-gradient(180deg, #4a9bff 0%, var(--c-accent) 100%);
    border-color: var(--c-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--c-accent-rgb), 0.4);
}

.actions-cell .btn-secondary,
.actions-cell .btn-outline-secondary {
    background: transparent;
    border-color: var(--c-border-str);
    color: var(--c-text-muted);
    box-shadow: none;
}
.actions-cell .btn-secondary:hover,
.actions-cell .btn-outline-secondary:hover {
    background: var(--c-overlay);
    border-color: var(--c-border-str);
    color: var(--c-text);
}

.actions-cell .btn-danger {
    background: var(--c-danger-dim);
    border-color: var(--c-danger-bdr);
    color: var(--c-danger);
    box-shadow: none;
}
.actions-cell .btn-danger:hover {
    background: linear-gradient(180deg, #f55468 0%, var(--c-danger) 100%);
    border-color: var(--c-danger);
    color: #fff;
    box-shadow: 0 2px 8px rgba(240, 64, 85, 0.4);
}

.actions-cell .btn-success {
    background: var(--c-success-dim);
    border-color: var(--c-success-bdr);
    color: var(--c-success);
    box-shadow: none;
}
.actions-cell .btn-success:hover {
    background: linear-gradient(180deg, #32d985 0%, var(--c-success) 100%);
    border-color: var(--c-success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(39, 201, 122, 0.4);
}

.actions-cell .btn-info {
    background: var(--c-info-dim);
    border-color: rgba(56, 189, 248, 0.28);
    color: var(--c-info);
    box-shadow: none;
}
.actions-cell .btn-info:hover {
    background: linear-gradient(180deg, #52ccff 0%, var(--c-info) 100%);
    border-color: var(--c-info);
    color: #fff;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

.actions-cell .btn-icon {
    width: 26px;
    height: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
}

/* Empty state */
.empty-state {
    padding: 3rem 2rem;
}

.empty-state-icon {
    color: var(--c-text-subtle);
    opacity: 0.35;
}

.empty-state-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--c-text-muted);
    margin-bottom: 0.375rem;
}

.empty-state-description {
    font-size: 0.8125rem;
    color: var(--c-text-subtle);
    margin: 0;
}

/* Table footer */
.table-footer {
    font-size: 0.75rem;
    color: var(--c-text-subtle);
}

/* === Stat tiles === */
.fp-stat-tile {
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.18s ease;
}

.fp-stat-tile:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.fp-stat-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.fp-stat-tile--blue::before   { background: var(--c-accent); }
.fp-stat-tile--green::before  { background: var(--c-green); }
.fp-stat-tile--amber::before  { background: var(--c-amber); }
.fp-stat-tile--teal::before   { background: var(--c-teal); }
.fp-stat-tile--violet::before { background: var(--c-violet); }
.fp-stat-tile--rose::before   { background: var(--c-rose); }

.fp-stat-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--c-text-subtle);
    margin-bottom: 0.375rem;
}

.fp-stat-value {
    font-size: 1.625rem;
    font-weight: 600;
    color: var(--s-color, var(--c-text));
    line-height: 1;
    font-family: var(--c-font-mono);
}

.fp-stat-sub {
    font-size: 0.6875rem;
    color: var(--c-text-muted);
    margin-top: 0.375rem;
}

.fp-stat-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    opacity: 0.07;
    pointer-events: none;
}

/* Stat tile — proxy data-a system */
.fp-stat-tile { --s-accent: var(--c-accent); --s-color: var(--c-text); }

.fp-stat-tile[data-a="blue"],
.fp-stat-tile--blue   { --s-accent: var(--c-accent); }
.fp-stat-tile[data-a="green"],
.fp-stat-tile--green  { --s-accent: var(--c-success); --s-color: var(--c-success); }
.fp-stat-tile[data-a="amber"],
.fp-stat-tile--amber  { --s-accent: var(--c-warning); --s-color: var(--c-warning); }
.fp-stat-tile[data-a="red"],
.fp-stat-tile--red    { --s-accent: var(--c-danger); --s-color: var(--c-danger); }
.fp-stat-tile[data-a="cyan"],
.fp-stat-tile--teal   { --s-accent: var(--c-info); }
.fp-stat-tile[data-a="purple"],
.fp-stat-tile--violet { --s-accent: var(--c-purple); }
.fp-stat-tile--rose   { --s-accent: var(--c-rose); }

.fp-stat-tile::before { background: var(--s-accent); }
.fp-stat-icon { color: var(--s-accent); }

/* === Colored badge variants === */
.fp-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.125rem 0.4375rem;
    border-radius: 20px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
}

.fp-badge--blue   { background: rgba(6, 111, 209, 0.12); border-color: rgba(6, 111, 209, 0.25); color: var(--c-accent-light); }
.fp-badge--green  { background: var(--c-green-bg); border-color: var(--c-green-border); color: #4ade80; }
.fp-badge--amber  { background: var(--c-amber-bg); border-color: var(--c-amber-border); color: #fbbf24; }
.fp-badge--teal   { background: var(--c-teal-bg); border-color: var(--c-teal-border); color: #2dd4bf; }
.fp-badge--violet { background: var(--c-violet-bg); border-color: var(--c-violet-border); color: #a78bfa; }
.fp-badge--red    { background: var(--c-red-bg); border-color: var(--c-red-border); color: #f87171; }

/* === More sidebar color === */
/* Sidebar section label */
#sidebar .nav-category {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--c-text-subtle);
    padding: 0.75rem 0.875rem 0.25rem;
    margin-top: 0.125rem;
}

/* Active link: subtle gradient background (light mode) */
#sidebar .nav-link.active {
    background: linear-gradient(90deg, var(--c-accent-glow) 0%, transparent 100%);
    border-radius: 0;
    margin-left: 0;
    margin-right: 0;
    padding-left: calc(0.75rem + 2px);
}

/* Topbar breadcrumb pill (optional enhancement) */
.fp-topbar-crumb {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--c-elevated);
    border: 1px solid var(--c-border);
    border-radius: 20px;
    padding: 0.1875rem 0.625rem 0.1875rem 0.4375rem;
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

.fp-topbar-crumb i {
    font-size: 0.75rem;
    color: var(--c-accent);
}
