/* =========================================
   DEALER PAGE HEADER
   ========================================= */

.dealer-page-header {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 24px;
}

.dealer-heading {
    width: 100%;
    min-width: 0;
}

.page-title {
    color: #101828;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 10px;
}

.page-subtitle {
    color: #667085;
    font-size: 1rem;
    line-height: 1.5;
    margin: 0;
}

.dealer-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    width: 100%;
    gap: 12px;
}

.header-action-btn {
    min-height: 48px;
    padding: 10px 18px;
    border: 1.5px solid transparent;
    border-radius: 10px;
    background-color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    flex: 0 0 auto;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

    .header-action-btn i {
        flex: 0 0 auto;
        font-size: 1rem;
        line-height: 1;
    }

    .header-action-btn span {
        display: inline-block;
    }

.action-primary {
    color: #ffffff;
    background-color: #4b75d1;
    border-color: #4b75d1;
}

    .action-primary:hover {
        color: #ffffff;
        background-color: #3f65b9;
        border-color: #3f65b9;
    }

.action-green {
    color: #079447;
    background-color: #ffffff;
    border-color: #12a150;
}

    .action-green:hover {
        color: #067a3c;
        background-color: #f0fdf4;
        border-color: #079447;
    }

.action-blue {
    color: #155eef;
    background-color: #ffffff;
    border-color: #2970ff;
}

    .action-blue:hover {
        color: #004eeb;
        background-color: #eff4ff;
        border-color: #155eef;
    }

.header-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 24, 40, 0.08);
}

.header-action-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.header-action-btn:focus-visible {
    outline: 3px solid rgba(41, 112, 255, 0.22);
    outline-offset: 2px;
}

/* =========================================
   KPI SUMMARY CARDS
   ========================================= */

.kpi-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.kpi-number {
    color: #111827;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.kpi-label {
    color: #6B7280;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-list {
    color: #4B5563;
    font-size: 0.8rem;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border-radius: 50%;
}

/* Icon colors */

.bg-light-green {
    color: #10B981;
    background-color: #ECFDF5;
}

.bg-light-gray {
    color: #6B7280;
    background-color: #F3F4F6;
}

.bg-light-yellow {
    color: #F59E0B;
    background-color: #FEF3C7;
}

.bg-light-red {
    color: #EF4444;
    background-color: #FEE2E2;
}

/* =========================================
   FILTER BAR
   ========================================= */

.filter-bar {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.search-wrap {
    position: relative;
    flex: 0 0 300px;
    min-width: 220px;
}

    .search-wrap i {
        position: absolute;
        top: 50%;
        left: 12px;
        color: #9CA3AF;
        transform: translateY(-50%);
    }

.search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px 8px 36px;
    color: #4B5563;
    background-color: #9e9e9e1c;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: 0.2s;
}

    .search-input:focus {
        background-color: #ffffff;
        border-color: #D1D5DB;
        outline: none;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

.filter-group {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-select {
    min-width: 110px;
    box-sizing: border-box;
    flex: 1 1 auto;
    padding: 8px 32px 8px 12px;
    color: #4B5563;
    background-color: #9e9e9e26;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236B7280'%3E%3Cpath d='M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    cursor: pointer;
}

    .filter-select:hover {
        background-color: #F3F4F6;
    }

/* =========================================
   DEALER REGISTRATION CARDS
   ========================================= */

.reg-card {
    height: 100%;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

    .reg-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    }

.card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
}

.card-top-right {
    min-width: 0;
    flex: 1;
}

/* Progress circles */

.progress-circle {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .progress-circle.p-80 {
        background: conic-gradient(#F59E0B 80%, #F3F4F6 0);
    }

    .progress-circle.p-30 {
        background: conic-gradient(#F59E0B 30%, #F3F4F6 0);
    }

    .progress-circle.p-100 {
        border: 4px solid #08875d;
        font-size: 1.5rem;
    }

    .progress-circle.p-60 {
        background: conic-gradient(#dbc730 30%, #F3F4F6 0);
    }

.progress-inner {
    width: 54px;
    height: 54px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.progress-val {
    color: #1F2937;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
}

.progress-steps {
    margin-top: 2px;
    padding: 0 2px;
    color: #6B7280;
    font-size: 0.45rem;
    line-height: 1.1;
    text-align: center;
    word-break: break-word;
}

/* =========================================
   STATUS BADGES
   ========================================= */

.badge-group {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.badge-custom {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-yellow {
    color: #B45309;
    background-color: #FEF3C7;
}

.badge-green-dashboard {
    color: #047857;
    background-color: #D1FAE5;
}

/* =========================================
   CARD ACTION BUTTONS
   ========================================= */

.btn-continue-blue {
    padding: 3px 6px;
    color: #ffffff;
    background-color: #4970c6;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.btn-continue-green {
    padding: 6px 12px;
    color: #ffffff;
    background-color: #10B981;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-view {
    padding: 3px 6px;
    color: #4B5563;
    background-color: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.btn-dots {
    padding: 2px 8px;
    color: #4B5563;
    background-color: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1;
}

/* =========================================
   CARD CONTENT
   ========================================= */

.reg-id {
    display: inline-block;
    padding: 4px 8px;
    margin-bottom: 12px;
    color: #b45309a8;
    background-color: #FEF9C3;
    border-radius: 25px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.company-name {
    margin-bottom: 8px;
    color: #1F2937;
    font-size: 1.1rem;
    font-weight: 700;
    word-break: break-word;
}

.location-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    color: #4B5563;
    font-size: 0.75rem;
}

    .location-info i {
        color: #6B7280;
        font-size: 0.85rem;
    }

.location-divider {
    color: #D1D5DB;
}

.tags-row {
    margin-top: auto;
    margin-bottom: 20px;
    padding: 10px 16px;
    color: #4B5563;
    background-color: #f0fdf47d;
    border: 1px solid #d9ebde;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.bullet-dot {
    margin: 0 6px;
    color: #D1D5DB;
}

.card-footer-note {
    margin-top: auto;
    padding: 10px 16px;
    color: #065F46;
    background-color: #F0FDF4;
    border: 1px solid #d9ebde;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */

/* Large and zoomed desktop */

@media (max-width: 1500px) {
    .dealer-page-header {
        gap: 20px;
    }

    .dealer-header-actions {
        justify-content: flex-start;
    }

    .header-action-btn {
        min-height: 44px;
        padding: 9px 15px;
        font-size: 0.85rem;
    }
}

/* Laptop */

@media (max-width: 1199.98px) {
    .dealer-page-header {
        gap: 18px;
    }

    .dealer-header-actions {
        justify-content: flex-start;
        gap: 10px;
    }

    .header-action-btn {
        min-height: 42px;
        padding: 8px 13px;
        font-size: 0.8rem;
    }
}

/* Tablet */

@media (max-width: 991.98px) {
    .dealer-header-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: 10px;
    }

    .header-action-btn {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        padding: 9px 12px;
        white-space: normal;
    }

    .filter-bar {
        padding: 12px;
    }

    .filter-group {
        display: contents;
    }

    .search-wrap,
    .filter-select {
        min-width: 140px;
        flex: 1 1 calc(50% - 8px);
    }

    .kpi-card {
        padding: 14px;
    }

    .kpi-number {
        font-size: 1.5rem;
    }
}

/* Mobile */

@media (max-width: 575.98px) {
    .dealer-page-header {
        gap: 16px;
    }

    .page-title {
        margin-bottom: 6px;
        font-size: 1.15rem;
    }

    .page-subtitle {
        font-size: 0.78rem;
        line-height: 1.45;
    }

    .dealer-header-actions {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .header-action-btn {
        width: 100%;
        min-height: 42px;
        padding: 8px 12px;
        font-size: 0.78rem;
    }

    /* KPI cards */

    .kpi-card {
        padding: 12px;
    }

    .kpi-icon {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .kpi-number {
        font-size: 1.35rem;
    }

    .kpi-label {
        font-size: 0.7rem;
    }

    .kpi-subtext {
        padding: 4px 6px !important;
        font-size: 0.65rem !important;
    }

    /* Filter bar */

    .filter-bar {
        flex-direction: row;
        align-items: stretch;
        flex-wrap: wrap;
        gap: 12px;
    }

    .filter-group {
        display: contents;
    }

    .search-wrap,
    .filter-select {
        width: auto;
        min-width: 0;
        flex: 1 1 calc(50% - 6px);
    }

    .search-input {
        padding: 8px 12px 8px 32px;
        font-size: 0.8rem;
    }

    /* Dealer card */

    .card-top-row {
        gap: 14px;
        margin-bottom: 16px;
    }

    .btn-continue-blue,
    .btn-view,
    .btn-dots {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .company-name {
        font-size: 0.95rem;
    }

    .location-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        font-size: 0.7rem;
    }

    .location-divider {
        display: none;
    }

    .tags-row {
        padding: 8px 12px;
        font-size: 0.7rem;
        line-height: 1.8;
    }

    .bullet-dot {
        margin: 0 4px;
    }

    .card-footer-note {
        padding: 8px 12px;
        font-size: 0.7rem;
    }

    /* Modal */

    .modal-dialog {
        max-width: calc(100% - 24px);
        margin: 12px;
    }

    .modal-body {
        padding: 16px;
    }
}

/* native: phone */
/* Phone-only (<= 767.98px). Desktop and tablet rules above are untouched. */
@media (max-width: 767.98px) {
    /* Header actions: two compact columns instead of one long stack. */
    .dash-page .dealer-header-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .dash-page .header-action-btn {
        width: 100%;
        min-height: var(--tap-min, 44px);
        padding: 8px 10px;
        font-size: 0.78rem;
        white-space: normal;
    }

    /* Filters: native-sized tap targets. */
    .dash-page .search-input,
    .dash-page .filter-select {
        min-height: var(--tap-min, 44px) !important;
        font-size: 16px; /* prevents iOS zoom-on-focus */
    }

    /* Dealer cards: 44px touch targets, actions always visible, no hover lift. */
    .dash-page .reg-card {
        padding: 14px;
    }

    .dash-page .reg-card:hover {
        transform: none;
    }

    /* Status circle on the left, badges and buttons on the right, in one row. */
    .dash-page .card-top-row {
        flex-wrap: nowrap;
        align-items: flex-start;
        gap: 10px;
    }

    .dash-page .card-top-row > .progress-circle,
    .dash-page .card-top-row > .new-dealer-first-complete {
        width: 52px;
        height: 52px;
        min-width: 52px;
        flex-shrink: 0;
    }

    .dash-page .card-top-row > .new-dealer-first-complete {
        border-width: 4px;
    }

    .dash-page .card-top-row > .new-dealer-first-complete i {
        font-size: 28px;
    }

    .dash-page .card-top-row > .progress-circle .progress-inner {
        width: 44px;
        height: 44px;
    }

    .dash-page .card-top-row > .progress-circle .progress-val {
        font-size: 0.75rem;
    }

    /* Labels and buttons flow as one continuous wrapping row beside the circle
       (the two inner groups are flattened), right-aligned to the card edge. */
    .dash-page .card-top-right {
        flex: 1 1 0;
        min-width: 0;
        flex-direction: row !important;      /* overrides Bootstrap .flex-column */
        flex-wrap: wrap;
        align-items: center !important;
        align-content: flex-start;
        justify-content: flex-end !important;
        gap: 5px !important;
    }

    .dash-page .card-top-right .badge-group,
    .dash-page .card-action-row {
        display: contents !important;
        justify-content: flex-end !important;
    }

    /* Every button and status label in the card: one compact, uniform size. */
    .dash-page .card-top-right .badge-custom,
    .dash-page .btn-view,
    .dash-page .btn-dots,
    .dash-page .btn-continue-blue,
    .dash-page .btn-credit-limit,
    .dash-page .btn-update-existing-dealer {
        height: 26px;
        min-height: 26px;
        min-width: 26px;
        padding: 0 7px;
        font-size: 0.65rem;
        font-weight: 600;
        line-height: 1;
        border-radius: 5px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 3px;
    }

    .dash-page .card-top-right i {
        font-size: 0.72rem;
        margin-right: 0 !important; /* gap handles icon spacing */
    }

    /* Bootstrap modals on this page slide up as bottom sheets. */
    .dash-modal .modal-dialog {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        max-width: none;
        width: 100%;
        align-items: flex-end;
        min-height: 0;
    }

    .dash-modal .modal-content {
        border-radius: 16px 16px 0 0 !important;
        max-height: calc(100vh - 48px);
        max-height: calc(100dvh - 48px);
        overflow-y: auto;
        padding-bottom: var(--safe-bottom, 0px);
    }

    .dash-modal .modal-footer .btn,
    .dash-modal .modal-body .btn {
        min-height: var(--tap-min, 44px);
    }
}

/* "Show more" row under the registration cards (cards render in batches of 30). */
.dash-show-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 0 4px;
}

    .dash-show-more .btn {
        min-height: var(--tap-min, 44px);
    }
