/* ========================================
   DFI Network Members - Modern Premium Design
   ======================================== */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Brand Colors */
    --dfi-primary: #1a2540;
    /* Primary dark blue from logo */
    --dfi-primary-dark: #0f1829;
    /* Darker shade */
    --dfi-primary-light: #2a3550;
    /* Lighter shade */
    --dfi-secondary: #ed2024;
    /* Secondary red from logo */
    --dfi-secondary-dark: #c91a1e;
    /* Darker red */
    --dfi-secondary-light: #f14347;
    /* Lighter red */
    --dfi-accent: #f59e0b;
    /* Accent amber */
    --dfi-dark: #1f2937;
    --dfi-gray: #6b7280;
    --dfi-light-gray: #f3f4f6;
    --dfi-white: #ffffff;
    --dfi-border: #e5e7eb;


    /* Shadows */
    --dfi-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --dfi-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --dfi-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --dfi-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --dfi-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Wrapper */
.dfi-nm-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ========================================
   Search Bar
   ======================================== */
.dfi-nm-search-container {
    position: relative;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.dfi-search-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 16px;
    border: 2px solid var(--dfi-border);
    border-radius: 50px;
    background: var(--dfi-white);
    transition: var(--dfi-transition);
    font-family: 'Inter', sans-serif;
}

.dfi-search-input:focus {
    outline: none;
    border-color: var(--dfi-primary);
    box-shadow: 0 0 0 4px rgba(26, 37, 64, 0.1);
}

.dfi-search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--dfi-gray);
    pointer-events: none;
    transition: var(--dfi-transition);
}


/* Search Status Message */
.dfi-search-status {
    background: var(--dfi-secondary);
    color: var(--dfi-white);
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--dfi-shadow-sm);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dfi-search-status-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}


/* ========================================
   Filter Tabs
   ======================================== */
.dfi-nm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 40px;
    justify-content: center;
}

.dfi-filter-btn {
    position: relative;
    padding: 12px 24px;
    background: var(--dfi-white);
    border: 2px solid transparent;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--dfi-transition);
    color: var(--dfi-dark);
    font-family: 'Inter', sans-serif;
    box-shadow: var(--dfi-shadow-sm);
}

.dfi-filter-btn span {
    position: relative;
    z-index: 1;
}

.dfi-filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--dfi-shadow-md);
    border-color: var(--dfi-primary);
}

.dfi-filter-btn.active {
    background: var(--dfi-primary);
    color: var(--dfi-white);
    border-color: transparent;
    box-shadow: var(--dfi-shadow-lg);
}

/* ========================================
   Main Content Layout
   ======================================== */
.dfi-nm-main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 40px;
    align-items: start;
    /* Prevent cards from stretching to match height */
}

/* ========================================
   Map Section
   ======================================== */
.dfi-nm-map-section {
    background: var(--dfi-white);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--dfi-shadow-lg);
    border: 1px solid var(--dfi-border);
}

.dfi-map-header {
    margin-bottom: 25px;
}

.dfi-map-header h2 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--dfi-primary);
}

.dfi-map-header p {
    margin: 0;
    color: var(--dfi-gray);
    font-size: 14px;
}

.dfi-map-placeholder {
    position: relative;
    background: var(--dfi-light-gray);
    border-radius: 16px;
    overflow: hidden;
    /* min-height: 600px; Removed to fit image naturally */
    display: flex;
    align-items: center;
    justify-content: center;
}

.dfi-africa-map {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: var(--dfi-transition);
}

.dfi-africa-map:hover {
    transform: scale(1.02);
}


/* ========================================
   Members Sidebar
   ======================================== */
.dfi-nm-sidebar {
    background: var(--dfi-white);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--dfi-shadow-lg);
    border: 1px solid var(--dfi-border);
    /* max-height: 800px; Removed to prevent squashing */
    display: flex;
    flex-direction: column;
}

.dfi-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--dfi-light-gray);
}

.dfi-sidebar-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--dfi-dark);
}

.dfi-member-count {
    background: var(--dfi-secondary);
    color: var(--dfi-white);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
}

/* ========================================
   Members List
   ======================================== */
.dfi-members-list {
    overflow-y: auto;
    flex: 1;
    padding-right: 10px;
    padding-right: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    align-content: start;
}

/* Tablet: Fluid columns handled by minmax */
@media (min-width: 768px) {
    /* No manual column overrides needed */
}

/* Desktop: Fluid columns handled by minmax */
@media (min-width: 1200px) {
    /* No manual column overrides needed */

    /* Adjust Card Internal Grid for 3+ Columns */
    .dfi-member-item {
        grid-template-columns: 50px 1fr auto;
        gap: 12px;
        padding: 12px;
    }

    .dfi-member-flag {
        width: 50px;
        height: 50px;
    }

    .dfi-member-title {
        font-size: 15px;
    }

    .dfi-member-excerpt {
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }
}



/* Custom Scrollbar */
.dfi-members-list::-webkit-scrollbar {
    width: 6px;
}

.dfi-members-list::-webkit-scrollbar-track {
    background: var(--dfi-light-gray);
    border-radius: 10px;
}

.dfi-members-list::-webkit-scrollbar-thumb {
    background: var(--dfi-primary);
    border-radius: 10px;
}

.dfi-members-list::-webkit-scrollbar-thumb:hover {
    background: var(--dfi-primary-dark);
}

/* ========================================
   Member Item Card
   ======================================== */
.dfi-member-item {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 15px;
    padding: 16px;
    min-width: 250px;
    background: var(--dfi-white);
    border: 2px solid var(--dfi-border);
    border-radius: 12px;
    transition: var(--dfi-transition);
    cursor: pointer;
}

.dfi-member-item:hover {
    transform: translateX(5px);
    border-color: var(--dfi-primary);
    box-shadow: var(--dfi-shadow-md);
}

.dfi-member-item.hidden {
    display: none;
}

/* Flag/Logo */
.dfi-member-flag {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--dfi-shadow-sm);
    flex-shrink: 0;
}

.dfi-member-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dfi-flag-placeholder {
    width: 100%;
    height: 100%;
    background: var(--dfi-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--dfi-white);
    text-transform: uppercase;
}

/* Member Info */
.dfi-member-info {
    flex: 1;
    min-width: 0;
}

.dfi-member-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.dfi-member-title a {
    color: var(--dfi-dark);
    text-decoration: none;
    transition: var(--dfi-transition);
}

.dfi-member-title a:hover {
    color: var(--dfi-primary);
}

.dfi-member-meta {
    margin-bottom: 8px;
}

.dfi-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--dfi-gray);
    background: var(--dfi-light-gray);
    padding: 4px 10px;
    border-radius: 50px;
}

.dfi-location-badge svg {
    width: 14px;
    height: 14px;
}

.dfi-member-excerpt {
    margin: 0;
    font-size: 13px;
    color: var(--dfi-gray);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Member Actions */
.dfi-member-actions {
    display: flex;
    align-items: center;
}

.dfi-view-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dfi-secondary);
    border-radius: 50%;
    transition: var(--dfi-transition);
    text-decoration: none;
}

.dfi-view-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--dfi-shadow-md);
}

.dfi-view-btn svg {
    width: 16px;
    height: 16px;
    color: var(--dfi-white);
}

/* ========================================
   No Members State
   ======================================== */
.dfi-no-members {
    text-align: center;
    padding: 60px 20px;
    color: var(--dfi-gray);
}

.dfi-no-members p {
    margin: 0;
    font-size: 16px;
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet */
@media (max-width: 1024px) {
    .dfi-nm-main-content {
        grid-template-columns: 1fr;
    }



    .dfi-nm-sidebar {
        max-height: 500px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .dfi-nm-wrapper {
        padding: 20px 15px;
    }

    /* Mobile search adjustments */
    .dfi-search-input {
        padding: 14px 80px 14px 16px;
        /* Adjusted for mobile */
    }

    .dfi-search-icon {
        right: 45px;
    }

    .dfi-search-input:not(.has-value)~.dfi-search-icon {
        right: 15px;
    }

    .dfi-nm-filters {
        padding: 15px;
        gap: 8px;
    }

    .dfi-filter-btn {
        padding: 10px 18px;
        font-size: 13px;
    }

    .dfi-nm-map-section,
    .dfi-nm-sidebar {
        padding: 20px;
    }

    .dfi-map-header h2 {
        font-size: 22px;
    }

    .dfi-map-placeholder {
        min-height: 400px;
    }

    .dfi-member-item {
        grid-template-columns: 50px 1fr auto;
        gap: 12px;
        padding: 12px;
    }

    .dfi-member-flag {
        width: 50px;
        height: 50px;
    }

    .dfi-member-title {
        font-size: 14px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .dfi-search-input {
        font-size: 14px;
        padding: 14px 45px 14px 16px;
    }

    .dfi-sidebar-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dfi-member-item {
        grid-template-columns: 1fr;
    }

    .dfi-member-flag {
        width: 100%;
        height: 120px;
    }

    .dfi-member-actions {
        justify-content: flex-end;
    }
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dfi-member-item {
    animation: fadeIn 0.3s ease-out;
}

/* ========================================
   Single Member Details Page
   ======================================== */

.dfi-single-member-wrapper {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Back Button */
.dfi-back-button-container {
    margin-bottom: 30px;
}

.dfi-back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--dfi-white);
    border: 2px solid var(--dfi-primary);
    border-radius: 50px;
    color: var(--dfi-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: var(--dfi-transition);
    box-shadow: var(--dfi-shadow-sm);
}

.dfi-back-button:hover {
    background: var(--dfi-primary);
    color: var(--dfi-white);
    transform: translateX(-5px);
    box-shadow: var(--dfi-shadow-md);
}

.dfi-back-button svg {
    width: 20px;
    height: 20px;
}

/* Member Details Card */
.dfi-member-details-card {
    background: var(--dfi-white);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--dfi-shadow-lg);
    border: 1px solid var(--dfi-border);
}

/* Flag Header */
.dfi-member-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--dfi-light-gray);
}

.dfi-member-flag-large {
    width: 200px;
    height: 133px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--dfi-shadow-lg);
    border: 3px solid var(--dfi-white);
    outline: 2px solid var(--dfi-border);
}

.dfi-member-flag-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Detail Rows */
.dfi-detail-row {
    display: flex;
    gap: 20px;
    padding: 25px 0;
    border-bottom: 1px solid var(--dfi-light-gray);
}

.dfi-detail-row:last-child {
    border-bottom: none;
}

.dfi-detail-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dfi-primary);
    border-radius: 12px;
    box-shadow: var(--dfi-shadow-sm);
}

.dfi-detail-icon svg {
    width: 24px;
    height: 24px;
    color: var(--dfi-white);
}

.dfi-location-row .dfi-detail-icon {
    background: var(--dfi-secondary);
}

.dfi-services-row .dfi-detail-icon {
    background: var(--dfi-primary-light);
}

.dfi-detail-content {
    flex: 1;
}

.dfi-detail-content strong {
    display: block;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dfi-gray);
    margin-bottom: 8px;
    font-weight: 600;
}

.dfi-detail-content p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dfi-dark);
}

.dfi-detail-content a {
    color: var(--dfi-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--dfi-transition);
}

.dfi-detail-content a:hover {
    color: var(--dfi-secondary);
    text-decoration: underline;
}

/* Responsive for Single Page */
@media (max-width: 768px) {
    .dfi-member-details-card {
        padding: 25px;
    }

    .dfi-member-flag-large {
        width: 150px;
        height: 100px;
    }

    .dfi-detail-row {
        flex-direction: column;
        gap: 15px;
        padding: 20px 0;
    }

    .dfi-detail-icon {
        width: 40px;
        height: 40px;
    }

    .dfi-detail-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {

    .dfi-nm-filters,
    .dfi-nm-search-container,
    .dfi-member-actions {
        display: none;
    }

    .dfi-nm-main-content {
        grid-template-columns: 1fr;
    }

    .dfi-members-list {
        max-height: none;
        overflow: visible;
    }
}

/* ========================================
   Pagination
   ======================================== */
.dfi-pagination-controls {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--dfi-light-gray);
    display: flex;
    justify-content: center;
}

.dfi-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.dfi-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--dfi-border);
    background: var(--dfi-white);
    color: var(--dfi-gray);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--dfi-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dfi-page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--dfi-primary);
    color: var(--dfi-primary);
    background: rgba(26, 37, 64, 0.04);
    transform: translateY(-2px);
}

/* Increased Specificity for Active State */
.dfi-pagination .dfi-page-btn.active {
    background: transparent !important;
    color: var(--dfi-secondary) !important;
    border: 2px solid var(--dfi-secondary) !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}

.dfi-page-btn:disabled,
.dfi-page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--dfi-light-gray);
    border-color: transparent;
    color: var(--dfi-gray);
}

.dfi-page-btn.next,
.dfi-page-btn.prev {
    min-width: auto;
    padding: 0 16px;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.dfi-ellipsis {
    color: var(--dfi-gray);
    font-weight: 600;
    padding: 0 4px;
}

/* Responsive Pagination */
@media (max-width: 480px) {
    .dfi-page-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 0 8px;
    }
}