

/* Header Section */
.dd-header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.dd-header-text h1 {
    font-size: 24px;
    font-weight: 700;
    color: #334155;
    margin: 0 0 8px 0;
}

.dd-header-text p {
    font-size: 14px;
    color: #64748B;
    margin: 0;
}

/* Header Action Buttons */
.dd-header-actions {
    display: flex;
    gap: 12px;
}

.dd-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #F8FAFC;
    color: #475569;
    border: 1px solid #E2E8F0;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

    .dd-action-btn:hover {
        background-color: #F1F5F9;
        color: #1E293B;
        border-color: #CBD5E1;
    }

    .dd-action-btn svg {
        width: 16px;
        height: 16px;
        stroke-width: 1.5;
        color: #94A3B8;
    }

/* Stats Cards Grid */
.dd-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

/* Base Card Style */
.dd-stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    border-left: 4px solid;
}

.dd-card-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dd-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #64748B;
}

.dd-card-value {
    font-size: 28px;
    font-weight: 700;
    color: #1E293B;
    line-height: 1;
}

/* Card Icons */
.dd-card-icon {
    width: 48px;
    height: 48px;
    background-color: #FFFFFF;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    flex-shrink: 0;
}

    .dd-card-icon svg {
        width: 24px;
        height: 24px;
        fill: none;
        stroke-width: 1.5;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

/* --- Specific Card Themes --- */

/* 1. Total Dealers (Blue/Purple) */
.dd-card-total {
    background: linear-gradient(90deg, #F5F3FF 0%, #EDE9FE 100%);
    border-left-color: #4F46E5;
}

    .dd-card-total .dd-card-icon svg {
        stroke: #4F46E5;
    }

/* 2. Active Dealers (Green) */
.dd-card-active {
    background: linear-gradient(90deg, #ECFDF5 0%, #D1FAE5 100%);
    border-left-color: #059669;
}

    .dd-card-active .dd-card-icon svg {
        stroke: #059669;
    }

/* 3. Regions Covered (Orange/Brown) */
.dd-card-regions {
    background: linear-gradient(90deg, #FFF7ED 0%, #FFEDD5 100%);
    border-left-color: #D97706;
}

    .dd-card-regions .dd-card-icon svg {
        stroke: #D97706;
    }

/* 4. Recently Added (Pink/Magenta) */
.dd-card-recent {
    background: linear-gradient(90deg, #FDF4FF 0%, #FAE8FF 100%);
    border-left-color: #C026D3;
}

    .dd-card-recent .dd-card-icon svg {
        stroke: #C026D3;
    }


/* Responsive Design */
@media (max-width: 1024px) {
    .dd-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dd-header-container {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .dd-stats-grid {
        grid-template-columns: 1fr;
    }

    .dd-header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .dd-action-btn {
        flex: 1;
        justify-content: center;
    }
}
/* --- SCOPED CSS FOR DEALER FILTERS & TABLE --- */

/* Filters Section */
.dd-filters-card {
    background-color: #FFFFFF; /* Main body background should be white */
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden; /* Prevents header background from clipping corner radiuses */
}

.dd-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #EBEEEA;
    padding: 16px 24px; /* Internal padding for the header row */
    cursor: pointer;
}

.dd-filters-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #1E293B;
}

    .dd-filters-title svg {
        width: 18px;
        height: 18px;
    }

.dd-filters-toggle {
    color: #64748B;
}

    .dd-filters-toggle svg {
        width: 20px;
        height: 20px;
    }

/* Added a dedicated body class to match Figma layout padding */
.dd-filters-body {
    padding: 24px;
}

.dd-filters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.dd-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .dd-input-group label {
        font-size: 13px;
        font-weight: 600;
        color: #334155;
    }

.dd-select {
    appearance: none;
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    color: #64748B;
    width: 100%;
    outline: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

.dd-filters-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.dd-btn-clear {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #FFFFFF;
    color: #475569;
    border: 1px solid #CBD5E1;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

    .dd-btn-clear:hover {
        background-color: #F1F5F9;
    }

    .dd-btn-clear svg {
        width: 14px;
        height: 14px;
    }

.dd-btn-apply {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #2D72D9;
    color: #FFFFFF;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

    .dd-btn-apply:hover {
        background-color: #235BB3;
    }

    .dd-btn-apply svg {
        width: 14px;
        height: 14px;
    }
/* Table Section */
.dd-table-card {
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.dd-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

    .dd-table-header h2 {
        font-size: 18px;
        font-weight: 700;
        color: #1E293B;
        margin: 0;
    }

.dd-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

    .dd-search-box svg {
        position: absolute;
        left: 12px;
        width: 14px;
        height: 14px;
        color: #94A3B8;
    }

    .dd-search-box input {
        background-color: #EBEEEA;
        border: 1px solid transparent;
        border-radius: 6px;
        padding: 8px 12px 8px 32px;
        font-size: 13px;
        color: #334155;
        width: 240px;
        outline: none;
        transition: border-color 0.2s;
    }

        .dd-search-box input:focus {
            border-color: #CBD5E1;
            background-color: #FFFFFF;
        }

.dd-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    margin-bottom: 20px;
}

.dd-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center; /* Centers all table content */
    min-width: 900px; /* Prevents squishing on small screens */
}

    .dd-table th {
        background-color: #EBEEEA;
        color: #475569;
        font-size: 13px;
        font-weight: 600;
        padding: 16px;
        border-bottom: 1px solid #E2E8F0;
    }

    .dd-table td {
        padding: 16px;
        font-size: 13px;
        color: #334155;
        border-bottom: 1px solid #F1F5F9;
    }

    .dd-table tr:last-child td {
        border-bottom: none;
    }

/* Status Badges */
.dd-badge {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
}

.dd-badge-active {
    background-color: #DCFCE7;
    color: #16A34A;
}

.dd-badge-inactive {
    background-color: #F1F5F9;
    color: #64748B;
}

/* Table Footer (Pagination) */
.dd-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dd-items-per-page {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #475569;
}

    .dd-items-per-page select {
        border: 1px solid #E2E8F0;
        border-radius: 6px;
        padding: 6px 32px 6px 12px;
        font-size: 13px;
    }

.dd-pagination {
    display: flex;
    gap: 4px;
}

.dd-page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

    .dd-page-btn:hover:not(.disabled):not(.active) {
        background-color: #F8FAFC;
    }

    .dd-page-btn.active {
        background-color: #F1F5F9;
        border-color: #CBD5E1;
        color: #1E293B;
        font-weight: 600;
    }

    .dd-page-btn.disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    .dd-page-btn svg {
        width: 16px;
        height: 16px;
    }

/* Responsive Adjustments */
@media (max-width: 992px) {
    .dd-filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .dd-filters-grid {
        grid-template-columns: 1fr;
    }

    .dd-table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .dd-search-box input {
        width: 100%;
    }

    .dd-table-footer {
        flex-direction: column;
        gap: 16px;
    }
}

/* =====================================================================
   PHONE (<= 767.98px) - breakpoint contract in css/tokens.css.
   Desktop and tablet keep the seven-column table exactly as it is.

   Problem fixed: .dd-table has `min-width: 900px` inside an
   `overflow-x: auto` wrapper, so on a 392px phone only Dealer Code,
   Firm Name and half of State were visible - Head Quarters, Mobile No.,
   Email and Status sat off-screen behind an invisible overlay scrollbar.
   Below 768px each row becomes a card and every column is labelled from
   its data-label attribute, the same pattern the other list pages use
   (see css/AgeingReport.css).
   ===================================================================== */
@media (max-width: 767.98px) {
    .dd-table-wrapper {
        overflow-x: hidden;
        border: 0;
        border-radius: 0;
    }

    .dd-table {
        min-width: 0;
        text-align: left;
    }

        .dd-table thead {
            display: none;
        }

        .dd-table tbody,
        .dd-table tr,
        .dd-table td {
            display: block;
            width: 100%;
        }

        .dd-table tr {
            padding: 6px 12px;
            margin-bottom: 10px;
            border: 1px solid #E2E8F0;
            border-radius: 10px;
            background: #FFFFFF;
        }

        .dd-table td {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            padding: 8px 0;
            border-bottom: 1px solid #F1F5F9;
            text-align: right;
            overflow-wrap: anywhere;
        }

            .dd-table td::before {
                content: attr(data-label);
                flex: 0 0 42%;
                color: #64748B;
                font-weight: 500;
                text-align: left;
            }

            .dd-table td[data-label="Firm Name"] {
                font-weight: 600;
                color: #0F172A;
            }

        .dd-table tr td:last-child {
            border-bottom: 0;
        }

    /* Header actions and pagination stay tappable and on-screen. */
    .dd-action-btn {
        min-height: var(--tap-min, 44px);
    }

    .dd-table-footer {
        align-items: center;
        gap: 12px;
    }

    .dd-pagination {
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    .dd-page-btn {
        width: 28px;
        height: 28px;
        flex: 0 0 auto;
    }

    .dd-pagination .dd-page-btn:not(.active):not(:first-child):not(:last-child) {
        display: none;
    }
}