/**
 * Member Directory & Referral System Styles
 * 
 * @package Member_Directory_Referral
 * @version 1.0.0
 */

/* ================================
   Container & Layout
   ================================ */

.mdr-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ================================
   Search Section
   ================================ */

.mdr-search-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mdr-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.mdr-search-field {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mdr-search-field:focus {
    outline: none;
    border-color: #1da1f2;
    box-shadow: 0 0 0 3px rgba(29, 161, 242, 0.1);
}

.mdr-search-button {
    padding: 12px 24px;
    background: #1da1f2;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mdr-search-button:hover {
    background: #1a91da;
    transform: translateY(-1px);
}

.mdr-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.mdr-filter-select {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    font-size: 14px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mdr-filter-select:focus {
    outline: none;
    border-color: #1da1f2;
}

.mdr-clear-button {
    padding: 10px 20px;
    background: #fff;
    color: #657786;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.mdr-clear-button:hover {
    background: #f5f8fa;
    border-color: #1da1f2;
    color: #1da1f2;
}

.mdr-view-toggle {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e1e8ed;
}

.mdr-view-btn {
    padding: 10px;
    background: #fff;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #657786;
}

.mdr-view-btn:hover {
    background: #f5f8fa;
    border-color: #1da1f2;
    color: #1da1f2;
}

.mdr-view-btn.active {
    background: #1da1f2;
    border-color: #1da1f2;
    color: #fff;
}

/* ================================
   Results Info
   ================================ */

.mdr-results-info {
    margin-bottom: 20px;
    color: #657786;
    font-size: 14px;
}

#mdr-results-count {
    font-weight: 600;
    color: #14171a;
}

/* ================================
   Loading Spinner
   ================================ */

.mdr-loading {
    text-align: center;
    padding: 40px;
}

.mdr-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #e1e8ed;
    border-top-color: #1da1f2;
    border-radius: 50%;
    animation: mdr-spin 0.8s linear infinite;
}

@keyframes mdr-spin {
    to { transform: rotate(360deg); }
}

/* ================================
   Grid Layout
   ================================ */

.mdr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.mdr-member-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mdr-member-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.mdr-card-header {
    padding: 24px 24px 0;
    text-align: center;
}

.mdr-member-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #f5f8fa;
}

.mdr-card-body {
    padding: 20px 24px;
    flex: 1;
}

.mdr-member-name {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #14171a;
    text-align: center;
}

.mdr-member-occupation {
    margin: 0 0 16px;
    font-size: 14px;
    color: #1da1f2;
    font-weight: 600;
    text-align: center;
}

.mdr-member-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e1e8ed;
}

.mdr-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #657786;
}

.mdr-detail-item svg {
    color: #aab8c2;
    flex-shrink: 0;
}

.mdr-card-footer {
    padding: 16px 24px;
    border-top: 1px solid #e1e8ed;
    background: #f5f8fa;
}

.mdr-contact-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.mdr-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #fff;
    border: 2px solid #e1e8ed;
    border-radius: 50%;
    color: #657786;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
}

.mdr-action-btn:hover {
    background: #1da1f2;
    border-color: #1da1f2;
    color: #fff;
    transform: scale(1.1);
}

/* ================================
   List/Table Layout
   ================================ */

.mdr-table-wrapper {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mdr-table {
    width: 100%;
    border-collapse: collapse;
}

.mdr-table thead {
    background: #f5f8fa;
}

.mdr-table th {
    padding: 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: #657786;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e1e8ed;
}

.mdr-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.mdr-table th.sortable:hover {
    background: #e1e8ed;
}

.mdr-table th .sort-icon {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #aab8c2;
    opacity: 0.5;
}

.mdr-table th.sort-asc .sort-icon {
    border-top: none;
    border-bottom: 4px solid #1da1f2;
    opacity: 1;
}

.mdr-table th.sort-desc .sort-icon {
    border-top: 4px solid #1da1f2;
    opacity: 1;
}

.mdr-table td {
    padding: 16px;
    border-bottom: 1px solid #e1e8ed;
    font-size: 14px;
    color: #14171a;
}

.mdr-member-row:hover {
    background: #f5f8fa;
}

.mdr-td-avatar {
    width: 60px;
}

.mdr-member-avatar-small {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.mdr-member-name-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mdr-join-date {
    font-size: 12px;
    color: #657786;
}

.mdr-contact-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mdr-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #1da1f2;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
}

.mdr-contact-link:hover {
    color: #1a91da;
    text-decoration: underline;
}

.mdr-td-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mdr-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f5f8fa;
    border-radius: 50%;
    color: #657786;
    transition: all 0.3s ease;
    text-decoration: none;
}

.mdr-action-icon:hover {
    background: #1da1f2;
    color: #fff;
}

/* ================================
   Buttons
   ================================ */

.mdr-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.mdr-btn-primary {
    background: #1da1f2;
    color: #fff;
}

.mdr-btn-primary:hover {
    background: #1a91da;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(29, 161, 242, 0.3);
}

.mdr-btn-secondary {
    background: #fff;
    color: #657786;
    border: 2px solid #e1e8ed;
}

.mdr-btn-secondary:hover {
    background: #f5f8fa;
    border-color: #1da1f2;
    color: #1da1f2;
}

.mdr-btn-referral {
    width: 100%;
    background: linear-gradient(135deg, #1da1f2 0%, #0c85d0 100%);
    color: #fff;
}

.mdr-btn-referral:hover {
    background: linear-gradient(135deg, #1a91da 0%, #0a75b8 100%);
    box-shadow: 0 4px 16px rgba(29, 161, 242, 0.4);
}

.mdr-btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* ================================
   Modal
   ================================ */

.mdr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mdr-fadeIn 0.3s ease;
}

@keyframes mdr-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mdr-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.mdr-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: mdr-slideUp 0.3s ease;
}

@keyframes mdr-slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mdr-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: #f5f8fa;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #657786;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mdr-modal-close:hover {
    background: #e1e8ed;
    color: #14171a;
    transform: rotate(90deg);
}

.mdr-modal-header {
    padding: 32px;
    border-bottom: 1px solid #e1e8ed;
}

.mdr-modal-header h2 {
    margin: 0 0 12px;
    font-size: 24px;
    color: #14171a;
}

.mdr-recipient-info {
    padding: 12px;
    background: #e8f5fe;
    border-radius: 8px;
    font-size: 14px;
    color: #0c85d0;
}

/* ================================
   Form
   ================================ */

.mdr-referral-form {
    padding: 32px;
}

.mdr-form-section {
    margin-bottom: 24px;
}

.mdr-form-section h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: #14171a;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mdr-form-group {
    margin-bottom: 16px;
}

.mdr-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #14171a;
}

.mdr-form-group .required {
    color: #e0245e;
}

.mdr-form-group input,
.mdr-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.mdr-form-group input:focus,
.mdr-form-group textarea:focus {
    outline: none;
    border-color: #1da1f2;
    box-shadow: 0 0 0 3px rgba(29, 161, 242, 0.1);
}

.mdr-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.mdr-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 24px;
    border-top: 1px solid #e1e8ed;
}

/* ================================
   Success Message
   ================================ */

.mdr-success-message {
    text-align: center;
    padding: 48px 32px;
}

.mdr-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #17bf63 0%, #0f9954 100%);
    color: #fff;
    border-radius: 50%;
    font-size: 48px;
    margin-bottom: 24px;
    animation: mdr-successPop 0.6s ease;
}

@keyframes mdr-successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.mdr-success-message h3 {
    margin: 0 0 12px;
    font-size: 22px;
    color: #14171a;
}

.mdr-success-message p {
    margin: 0 0 24px;
    color: #657786;
    font-size: 15px;
}

/* ================================
   No Results
   ================================ */

.mdr-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #657786;
    font-size: 16px;
}

/* ================================
   Responsive Design
   ================================ */

@media (max-width: 768px) {
    .mdr-container {
        padding: 16px;
    }
    
    .mdr-search-section {
        padding: 16px;
    }
    
    .mdr-search-bar {
        flex-direction: column;
    }
    
    .mdr-filters {
        flex-direction: column;
    }
    
    .mdr-filter-select {
        width: 100%;
        min-width: 100%;
    }
    
    .mdr-grid {
        grid-template-columns: 1fr;
    }
    
    .mdr-table-wrapper {
        overflow-x: auto;
    }
    
    .mdr-table {
        min-width: 800px;
    }
    
    .mdr-form-row {
        grid-template-columns: 1fr;
    }
    
    .mdr-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .mdr-modal-header,
    .mdr-referral-form {
        padding: 20px;
    }
    
    .mdr-form-actions {
        flex-direction: column-reverse;
    }
    
    .mdr-form-actions .mdr-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .mdr-member-name {
        font-size: 18px;
    }
    
    .mdr-modal-header h2 {
        font-size: 20px;
    }
}

/* ================================
   Accessibility
   ================================ */

.mdr-btn:focus,
.mdr-search-field:focus,
.mdr-filter-select:focus,
.mdr-action-btn:focus,
.mdr-modal-close:focus {
    outline: 2px solid #1da1f2;
    outline-offset: 2px;
}

/* Hidden but accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
