/* Custom overrides — add agency-specific styles here */

/* ── Stage Progress Bar ──────────────────────────── */
.stage-progress-bar {
    gap: 4px;
}

.stage-phase {
    min-width: 0;
}

.stage-phase-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stage-step {
    padding: 2px 1px;
    min-width: 0;
}

.stage-step-bar {
    height: 6px;
    border-radius: 3px;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.stage-complete .stage-step-bar {
    opacity: 1;
}

.stage-current .stage-step-bar {
    opacity: 1;
    height: 8px;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
}

.stage-future .stage-step-bar {
    opacity: 0.2;
}

.stage-step-label {
    font-size: 0.55rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stage-current .stage-step-label {
    font-weight: 600;
    color: #e0e0e0;
}

.stage-step[data-clickable="1"] {
    cursor: pointer;
}

.stage-step[data-clickable="1"]:hover .stage-step-bar {
    height: 10px;
    opacity: 0.8;
}

/* ── Inline Editing on Detail Page ───────────────── */
/* Editable indicators hidden by default, shown only in edit mode */
.editable-title-detail,
.editable-badge,
.editable-value,
.editable-text {
    transition: border-color 0.2s, transform 0.15s;
}

.edit-mode .editable-title-detail {
    cursor: text;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.3);
}

.edit-mode .editable-title-detail:hover {
    border-bottom-color: var(--crm-accent);
}

.edit-mode .editable-badge {
    cursor: pointer;
    outline: 2px dashed rgba(255, 255, 255, 0.3);
    outline-offset: 2px;
    border-radius: 4px;
}

.edit-mode .editable-badge:hover {
    transform: scale(1.1);
    outline-color: var(--crm-accent);
}

.edit-mode .editable-value {
    cursor: pointer;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.3);
}

.edit-mode .editable-value:hover {
    border-bottom-color: var(--crm-accent);
}

.edit-mode .editable-text {
    cursor: text;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.3);
}

.edit-mode .editable-text:hover {
    border-bottom-color: var(--crm-accent);
}

/* ── Activity Timeline ───────────────────────────── */
.timeline-item {
    font-size: 0.85rem;
}

.timeline-avatar .badge {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Mobile: Stage Progress ──────────────────────── */
@media (max-width: 767.98px) {
    .stage-progress-bar {
        flex-direction: column;
        gap: 8px;
    }

    .stage-phase .d-flex {
        flex-wrap: nowrap;
    }

    .stage-step-label {
        display: none;
    }

    .stage-current .stage-step-label {
        display: block;
        font-size: 0.6rem;
    }

    .stage-step-bar {
        height: 8px;
    }

    .stage-current .stage-step-bar {
        height: 10px;
    }

    .timeline-item {
        font-size: 0.78rem;
    }
}

/* ── Dashboard Customization ───────────────────────── */
.widget-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px 6px 0 0;
    margin-bottom: 10px;
    border: 1px solid #dee2e6;
}

.widget-header label {
    font-weight: 600;
    margin-bottom: 0;
    cursor: pointer;
    font-size: 0.9rem;
}

.widget-toggle {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.sortable-ghost {
    opacity: 0.4;
    background: #f0f0f0;
}

.sortable-chosen {
    background: #e3f2fd;
    border-color: var(--crm-accent) !important;
}

.sortable-drag {
    opacity: 0.8;
    transform: rotate(2deg);
}

/* ── Mobile Bottom Navigation ────────────────────── */
.mobile-bottom-nav {
    display: none;
}

.fab-new-show {
    display: none;
}

@media (max-width: 767.98px) {
    /* Bottom nav bar */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #000;
        z-index: 1040;
        justify-content: space-around;
        align-items: center;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 0 4px;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        text-decoration: none;
        color: rgba(255, 255, 255, 0.5);
        font-size: 0.65rem;
        padding: 6px 8px;
        border-radius: 8px;
        transition: color 0.15s;
        min-width: 52px;
    }

    .mobile-nav-item i {
        font-size: 1.2rem;
    }

    .mobile-nav-item.active,
    .mobile-nav-item:hover {
        color: var(--crm-accent);
    }

    .mobile-nav-item.active {
        font-weight: 600;
    }

    /* Add bottom padding to main content so it clears the nav bar */
    main {
        padding-bottom: 70px !important;
    }

    /* Floating Action Button */
    .fab-new-show {
        display: flex;
        position: fixed;
        bottom: 80px;
        right: 16px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--crm-accent);
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        z-index: 1039;
        color: #fff;
        font-size: 1.5rem;
        text-decoration: none;
        border: none;
        transition: transform 0.15s, box-shadow 0.15s;
    }

    .fab-new-show:hover,
    .fab-new-show:active {
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
        color: #fff;
    }

    /* ── Mobile Deal Cards ───────────────────────────── */
    .mobile-deal-card {
        border-radius: 10px;
        transition: box-shadow 0.15s;
    }

    .mobile-deal-card:hover,
    .mobile-deal-card:active {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    }

    .mobile-deal-card strong {
        font-size: 0.9rem;
    }

    /* ── Mobile Contact Cards ────────────────────────── */
    .mobile-contact-card {
        border-radius: 10px;
        border-left: 3px solid var(--crm-accent);
        transition: box-shadow 0.15s;
    }

    .mobile-contact-card:hover,
    .mobile-contact-card:active {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    }

    .mobile-contact-card strong {
        font-size: 0.9rem;
    }

    /* ── Touch-friendly editable fields on deal detail ── */
    .editable-text,
    .editable-value,
    .editable-title-detail,
    .editable-badge {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 4px 0;
    }

    /* Stack detail columns vertically */
    .row.g-3 > .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Hide less-important table columns on mobile */
    .table .col-hide-mobile {
        display: none;
    }

    /* Responsive tables: smaller text */
    .table td, .table th {
        font-size: 0.78rem;
        padding: 0.3rem 0.4rem;
    }
}

/* ── FullCalendar Navigation Buttons ───────────── */
.fc .fc-prev-button,
.fc .fc-next-button {
    font-size: 0;
    position: relative;
    width: 36px;
    height: 36px;
    padding: 0;
}
.fc .fc-prev-button::after,
.fc .fc-next-button::after {
    font-size: 18px;
    font-family: 'bootstrap-icons';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.fc .fc-prev-button::after { content: '\F284'; }
.fc .fc-next-button::after { content: '\F285'; }
.fc .fc-button {
    border-radius: 6px !important;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #333;
}
.fc .fc-button:hover { background: #f0f0f0; }
.fc .fc-button-active,
.fc .fc-button.fc-button-active {
    background: var(--crm-accent) !important;
    color: #fff !important;
    border-color: var(--crm-accent) !important;
}
.fc .fc-today-button { font-size: 0.85rem; }
