/* =====================================================
   BUTTONS
===================================================== */

.btn-primary,
.btn-secondary,
.btn-danger {

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    padding: 10px 18px;

    border-radius: var(--radius-sm);

    border: none;

    cursor: pointer;

    font-size: 14px;
    font-weight: 600;

    transition: .18s ease;

    text-decoration: none;

}

.btn-primary {

    background: var(--gradient);
    color: #fff;
    box-shadow: 0 2px 8px rgba(23,101,245,.22);

}

.btn-primary:hover {

    filter: brightness(1.08);
    box-shadow: 0 4px 14px rgba(23,101,245,.3);

}

.btn-secondary {

    background: var(--surface);

    border: 1px solid var(--border);

    color: var(--text);

}

.btn-secondary:hover {

    background: var(--border-soft);

    border-color: var(--text-faint);

}

.btn-danger {

    background: var(--danger);

    color: white;

}

.btn-danger:hover {

    background: #DC2626;

}

/* Delete button in the Edit Project / Edit Lead / Edit Task modal
   footers — pushed to the far left of the flex-end footer row so it
   sits apart from Cancel/Save rather than next to them. */

.modal-footer-delete {

    margin-right: auto;

}

.full-width {

    width: 100%;

}

/* =====================================================
   CARDS
===================================================== */

.card {

    background: var(--surface);

    border-radius: var(--radius);

    border: none;

    padding: 20px;

    box-shadow: var(--shadow-card);

}

.card-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 16px;

}

.card-title {

    font-size: 15px;

    font-weight: 600;

}

/* =====================================================
   EMPTY STATES
===================================================== */

.empty-state {

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    text-align: center;

    padding: 48px;

}

.empty-icon {

    width: 64px;

    height: 64px;

    border-radius: var(--radius);

    background: var(--primary-light);

    color: var(--primary);

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 28px;

    margin-bottom: 16px;

}

.empty-state h2 {

    margin-bottom: 8px;

    font-size: 19px;

}

.empty-state p {

    color: var(--text-light);

    max-width: 400px;

    line-height: 1.6;

    font-size: 13.5px;

}

/* =====================================================
   BADGES
===================================================== */

.badge {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    padding: 4px 11px;

    border-radius: 999px;

    font-size: 11.5px;

    font-weight: 600;

}

.badge-primary {

    background: var(--primary-light);

    color: var(--primary-dark);

}

.badge-success {

    background: #DCFCE7;

    color: #15803D;

}

.badge-warning {

    background: #FEF3C7;

    color: #B45309;

}

.badge-neutral {

    background: var(--border-soft);

    color: var(--text-light);

}

.badge-danger {

    background: #FEE2E2;

    color: #B91C1C;

}

/* =====================================================
   AVATARS
===================================================== */

.avatar {

    width: 36px;

    height: 36px;

    border-radius: 50%;

    overflow: hidden;

    background: var(--border-soft);

    display: flex;

    align-items: center;

    justify-content: center;

    font-weight: 600;

    font-size: 13px;

}

.avatar img {

    width: 100%;

    height: 100%;

    object-fit: cover;

}

/* =====================================================
   TAGS
===================================================== */

.tag {

    display: inline-flex;

    align-items: center;

    gap: 5px;

    padding: 4px 10px;

    border-radius: 999px;

    background: var(--border-soft);

    font-size: 12px;

    font-weight: 500;

}

.tag.orange {

    background: var(--primary-light);

    color: var(--primary-dark);

}

.tag.blue {

    background: #EEF6FF;

    color: var(--blue);

}

.tag.green {

    background: #E9FAEF;

    color: #15803D;

}

/* =====================================================
   DROPDOWNS
===================================================== */

.dropdown {

    position: relative;

}

.dropdown-menu {

    position: absolute;

    top: calc(100% + 8px);

    right: 0;

    background: var(--surface-raised);

    border: 1px solid var(--hairline);

    border-radius: var(--radius);

    min-width: 200px;

    box-shadow: var(--shadow-raised);

    display: none;

    z-index: 20;

    padding: 6px;

}

.dropdown.open .dropdown-menu {

    display: block;

}

.dropdown-menu a {

    display: block;

    padding: 9px 12px;

    border-radius: 7px;

    color: var(--text);

    text-decoration: none;

    font-size: 13.5px;

}

.dropdown-menu a:hover {

    background: var(--border-soft);

}

/* =====================================================
   MODALS
===================================================== */

.modal-overlay {

    position: fixed;

    inset: 0;

    background: rgba(16,24,40,.45);

    display: none;

    justify-content: center;

    align-items: center;

    z-index: 500;

}

.modal {

    width: 600px;

    max-width: 95%;

    background: var(--surface-raised);

    border-radius: var(--radius-lg);

    padding: 26px;

    box-shadow: var(--shadow-raised);

}

.modal-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 18px;

}

.modal-header h2,
.modal-header h3 {

    font-size: 17px;

}

.modal-footer {

    display: flex;

    justify-content: flex-end;

    gap: 10px;

    margin-top: 22px;

}

/* =====================================================
   TOASTS
===================================================== */

.toast-container {

    position: fixed;

    top: 24px;

    right: 24px;

    z-index: 9999;

}

.toast {

    background: var(--surface);

    border-radius: var(--radius);

    border-left: 4px solid var(--primary);

    padding: 13px 16px;

    margin-bottom: 12px;

    min-width: min(300px, calc(100vw - 48px));

    max-width: calc(100vw - 48px);

    font-size: 13.5px;

    box-shadow: var(--shadow-md);

}

.toast.success,
.toast-success {

    border-left-color: var(--success);

}

/* showToast(message, type) adds `toast-<type>`; "danger" is the type
   the pages pass for errors. */
.toast.error,
.toast-danger {

    border-left-color: var(--danger);

}

.toast.warning,
.toast-warning {

    border-left-color: var(--warning);

}

/* =====================================================
   TABLES
===================================================== */

.table {

    width: 100%;

    border-collapse: collapse;

    font-size: 13.5px;

}

.table th {

    text-align: left;

    padding: 12px 14px;

    background: var(--surface-hover);

    border-bottom: 1px solid var(--hairline);

    font-weight: 500;

    font-size: 12px;

    color: var(--text-2);

    text-transform: uppercase;

    letter-spacing: .02em;

}

.table td {

    padding: 13px 14px;

    border-bottom: 1px solid var(--hairline);

}

.table tr:hover {

    background: var(--surface-hover);

}

/* =====================================================
   LOADERS
===================================================== */

.spinner {

    width: 36px;

    height: 36px;

    border: 3px solid var(--border);

    border-top-color: var(--primary);

    border-radius: 50%;

    animation: spin 1s linear infinite;

}

@keyframes spin {

    to {

        transform: rotate(360deg);

    }

}

/* =====================================================
   IN-APP CONFIRM MODAL
   Shared shell for confirmDialog() in js/shared/components.js —
   replaces the browser's native confirm() with something styled
   to match the app, e.g. the Delete button in the Project/Lead/
   Task edit modals. Markup is injected once into <body>, so this
   sits at z-index 700 — above the entity modals themselves (600),
   since it needs to appear on top of the Edit Task modal it was
   opened from.
===================================================== */

.app-confirm-overlay {

    position: fixed;
    inset: 0;

    background: rgba(16,24,40,.45);

    display: none;

    align-items: center;
    justify-content: center;

    padding: 20px;

    z-index: 700;

}

.app-confirm-overlay.open {

    display: flex;

}

.app-confirm-panel {

    width: 420px;
    max-width: 100%;

    background: var(--surface-raised);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-raised);

    animation: appConfirmIn .18s ease;

}

@keyframes appConfirmIn {

    from { transform: translateY(10px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }

}

.app-confirm-header {

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 20px;

    border-bottom: 1px solid var(--border);

}

.app-confirm-header h3 {

    font-size: 15px;
    font-weight: 700;
    color: var(--text);

}

.app-confirm-close {

    width: 28px;
    height: 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    background: transparent;

    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);

    transition: var(--transition);

}

.app-confirm-close:hover {

    background: var(--border-soft);
    color: var(--text);

}

.app-confirm-body {

    padding: 20px;

}

.app-confirm-body p {

    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-light);

}

.app-confirm-footer {

    display: flex;
    justify-content: flex-end;
    gap: 10px;

    padding: 14px 20px;

    border-top: 1px solid var(--border);

}

/* Dark mode tint for pills without their own override: translucent hue background with a lighter text of the same hue. */
body[data-theme="dark"] .badge-success {
    background: rgba(34, 197, 94, .16);
    color: #86EFAC;
}

body[data-theme="dark"] .badge-warning {
    background: rgba(245, 158, 11, .16);
    color: #FCD34D;
}

body[data-theme="dark"] .badge-danger {
    background: rgba(239, 68, 68, .16);
    color: #FCA5A5;
}

body[data-theme="dark"] .tag.green {
    background: rgba(34, 197, 94, .16);
    color: #86EFAC;
}

/* =====================================================
   UI ICONS
   Phosphor SVGs from assets/icons/ui/ used as a CSS mask so the
   colour follows currentColor. Fill weight (NAME-fill.svg) for stat
   tiles, regular weight (NAME.svg) for toolbar icons.
===================================================== */

.ui-icon {

    display: inline-block;

    width: 1em;

    height: 1em;

    flex: none;

    background-color: currentColor;

    -webkit-mask-size: contain;
    mask-size: contain;

    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;

    -webkit-mask-position: center;
    mask-position: center;

}

.ui-icon-trend-up {

    -webkit-mask-image: url("../../assets/icons/ui/trend-up-fill.svg");
    mask-image: url("../../assets/icons/ui/trend-up-fill.svg");

}

.ui-icon-trend-down {

    -webkit-mask-image: url("../../assets/icons/ui/trend-down-fill.svg");
    mask-image: url("../../assets/icons/ui/trend-down-fill.svg");

}

.ui-icon-chart-line-up {

    -webkit-mask-image: url("../../assets/icons/ui/chart-line-up-fill.svg");
    mask-image: url("../../assets/icons/ui/chart-line-up-fill.svg");

}

.ui-icon-target {

    -webkit-mask-image: url("../../assets/icons/ui/target-fill.svg");
    mask-image: url("../../assets/icons/ui/target-fill.svg");

}

.ui-icon-kanban {

    -webkit-mask-image: url("../../assets/icons/ui/kanban-fill.svg");
    mask-image: url("../../assets/icons/ui/kanban-fill.svg");

}

.ui-icon-wallet {

    -webkit-mask-image: url("../../assets/icons/ui/wallet-fill.svg");
    mask-image: url("../../assets/icons/ui/wallet-fill.svg");

}

.ui-icon-clock-countdown {

    -webkit-mask-image: url("../../assets/icons/ui/clock-countdown-fill.svg");
    mask-image: url("../../assets/icons/ui/clock-countdown-fill.svg");

}

.ui-icon-check-circle {

    -webkit-mask-image: url("../../assets/icons/ui/check-circle-fill.svg");
    mask-image: url("../../assets/icons/ui/check-circle-fill.svg");

}

.ui-icon-file-dashed {

    -webkit-mask-image: url("../../assets/icons/ui/file-dashed-fill.svg");
    mask-image: url("../../assets/icons/ui/file-dashed-fill.svg");

}

.ui-icon-calendar-blank {

    -webkit-mask-image: url("../../assets/icons/ui/calendar-blank-fill.svg");
    mask-image: url("../../assets/icons/ui/calendar-blank-fill.svg");

}

.ui-icon-chart-bar {

    -webkit-mask-image: url("../../assets/icons/ui/chart-bar.svg");
    mask-image: url("../../assets/icons/ui/chart-bar.svg");

}

.ui-icon-calendar {

    -webkit-mask-image: url("../../assets/icons/ui/calendar-blank.svg");
    mask-image: url("../../assets/icons/ui/calendar-blank.svg");

}

.ui-icon-funnel {

    -webkit-mask-image: url("../../assets/icons/ui/funnel.svg");
    mask-image: url("../../assets/icons/ui/funnel.svg");

}

.ui-icon-magnifying-glass {

    -webkit-mask-image: url("../../assets/icons/ui/magnifying-glass.svg");
    mask-image: url("../../assets/icons/ui/magnifying-glass.svg");

}

.ui-icon-gear-six {

    -webkit-mask-image: url("../../assets/icons/ui/gear-six.svg");
    mask-image: url("../../assets/icons/ui/gear-six.svg");

}

/* Toolbar icons: 16px with an 8px gap before the label */

.ui-icon-sm {

    width: 16px;

    height: 16px;

    margin-right: 8px;

}

/* =====================================================
   STAT ICON TILE
   Tinted tile + single-colour symbol. The tone sets the hue as
   color; the tile background is that hue at 14 percent.
===================================================== */

.stat-icon-tile {

    width: 36px;

    height: 36px;

    border-radius: var(--radius-sm);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    font-size: 18px;

    background: rgba(100, 116, 139, .14);

}

@supports (background: color-mix(in srgb, red 10%, transparent)) {

    .stat-icon-tile {

        background: color-mix(in srgb, currentColor 14%, transparent);

    }

}

.tone-success { color: var(--success); }
.tone-danger { color: var(--danger); }
.tone-blue { color: var(--primary); }
.tone-violet { color: var(--tone-violet); }
.tone-cyan { color: var(--info); }
.tone-neutral { color: var(--text-2); }
.tone-warning { color: var(--warning); }

/* ==========================================================
   SAMPLE DATA (Phase 8b): the "Sample" chip on cards and rows,
   and the Dashboard's note while sample data is loaded.
========================================================== */

.sample-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px dashed var(--border);
    background: var(--surface-hover);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.5;
    vertical-align: middle;
    white-space: nowrap;
}

.sample-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
}

.sample-banner p {
    margin: 0;
    flex: 1 1 260px;
    min-width: 0;
}

.sample-banner a,
.sample-banner button {
    flex: 0 0 auto;
    text-decoration: none;
}
