/**
 * Member Directory Viewer - Styles
 * Version: 1.0.0
 * Optimized for landscape viewing and readability
 */

/* ===========================
   Main Container
   =========================== */
.member-directory-viewer {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Error and info messages */
.mdv-error,
.mdv-login-required,
.mdv-no-results {
    padding: 15px 20px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    margin: 20px 0;
}

.mdv-error {
    background: #f8d7da;
    border-left-color: #dc3545;
}

/* ===========================
   List View
   =========================== */
.mdv-list-view {
    width: 100%;
}

.mdv-list-instruction-row {
    background: #f8f9fa;
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
}

.mdv-list-instruction-text {
    color: #343a40;
    font-size: 13px;
}

/* Search Bar */
.mdv-search-bar {
    background: #f8f9fa;
    padding: 10px 14px;
    border-radius: 0;
    border: 1px solid #dee2e6;
    border-top: none;
    border-bottom: none;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mdv-print-download-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.mdv-search-input {
    flex: 1;
    max-width: 420px;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.2s ease;
}

.mdv-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.12);
}

.mdv-search-status {
    color: #6c757d;
    font-size: 12px;
}

/* Table Wrap */
.mdv-table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    position: relative;
    border: 1px solid #dee2e6;
    border-radius: 0 0 6px 6px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-top: 0;
}

/* Main list table: widths are set dynamically in JS as max data length + 2ch. */
.mdv-table {
    width: max-content;
    min-width: calc(100% + 0.75in);
    margin-left: -0.75in;
    border-collapse: collapse;
    table-layout: auto;
    font-size: 9px;
    background: #fff;
}

.mdv-table thead {
    background: linear-gradient(to bottom, #f3f5f7 0%, #e6eaee 100%);
}

.mdv-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 6px 4px;
    text-align: left;
    font-weight: 700;
    color: #343a40;
    background: linear-gradient(to bottom, #f3f5f7 0%, #e6eaee 100%);
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.mdv-table td {
    padding: 4px 4px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    white-space: nowrap;
    line-height: 1.3;
}

.mdv-table tbody tr:hover {
    background-color: #f0f6fb;
}

.mdv-table tbody tr:last-child td {
    border-bottom: none;
}

.mdv-col-eye {
    width: 34px;
    text-align: center;
    padding-left: 2px !important;
    padding-right: 2px !important;
}

/* Eye / detail button */
.mdv-eye-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #0073aa;
    border-radius: 3px;
    text-decoration: none;
    font-size: 13px;
    line-height: 1;
    transition: background 0.2s ease, transform 0.15s ease;
}

.mdv-eye-btn:hover {
    background: #005177;
    transform: scale(1.12);
}

/* ===========================
   Detail View
   =========================== */
.mdv-detail-view {
    max-width: 900px;
    margin: 0 auto;
}

.mdv-detail-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.mdv-detail-title {
    margin: 15px 0 0 0;
    font-size: 28px;
    font-weight: 600;
    color: #212529;
}

.mdv-back-btn,
.mdv-back-btn-bottom {
    display: inline-block;
    padding: 8px 16px;
    background: #f8f9fa;
    color: #0073aa;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mdv-back-btn:hover,
.mdv-back-btn-bottom:hover {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
    text-decoration: none;
}

/* Detail Table - Vertical Display */
.mdv-detail-content {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.mdv-detail-print-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 26px;
}

.mdv-detail-print-text {
    color: #343a40;
    font-size: 13px;
}

.mdv-print-btn {
    padding: 6px 12px;
    background: #0073aa;
    color: #fff;
    border: 1px solid #0073aa;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.mdv-print-btn:hover {
    background: #005177;
    border-color: #005177;
}

.mdv-download-btn {
    padding: 6px 12px;
    background: #ffffff;
    color: #0073aa;
    border: 1px solid #0073aa;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.mdv-download-btn:hover {
    background: #eaf5fb;
}

.mdv-detail-table {
    width: 100%;
    border-collapse: collapse;
}

.mdv-detail-table tr {
    border-bottom: 1px solid #e9ecef;
}

.mdv-detail-table tr:last-child {
    border-bottom: none;
}

.mdv-detail-table th {
    width: 280px;
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
    vertical-align: top;
    border-right: 1px solid #e9ecef;
}

.mdv-detail-table td {
    padding: 15px 20px;
    color: #212529;
    word-break: break-word;
}

.mdv-detail-table tr:nth-child(even) th {
    background: #e9ecef;
}

.mdv-detail-footer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 2px solid #dee2e6;
}

/* ===========================
   Landscape Optimization
   =========================== */
@media screen and (orientation: landscape) and (min-width: 1024px) {
    .mdv-table {
        font-size: 9px;
    }
    .mdv-table th {
        padding: 5px 4px;
        font-size: 8px;
    }
    .mdv-table td {
        padding: 4px;
    }
}

/* ===========================
   Mobile Responsiveness
   =========================== */
@media (max-width: 768px) {
    .mdv-list-instruction-row {
        padding: 8px 10px;
        align-items: flex-start;
        flex-direction: column;
    }

    .mdv-list-instruction-text {
        font-size: 12px;
    }

    .mdv-search-bar {
        padding: 10px;
    }
    .mdv-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
        max-width: 100%;
    }
    .mdv-table-wrap {
        border-radius: 0;
        overflow-x: auto; /* allow scroll on narrow phones */
    }
    .mdv-table {
        font-size: 8px;
        min-width: 100%;
    }
    .mdv-table th,
    .mdv-table td {
        padding: 4px 3px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .mdv-detail-table th {
        width: 130px;
        padding: 10px 12px;
        font-size: 13px;
    }
    .mdv-detail-table td {
        padding: 10px 12px;
        font-size: 14px;
    }

    .mdv-detail-print-row {
        padding: 8px 10px;
    }

    .mdv-detail-print-text {
        font-size: 12px;
    }
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    .mdv-search-bar,
    .mdv-list-instruction-row,
    .mdv-back-btn,
    .mdv-back-btn-bottom,
    .mdv-eye-btn,
    .mdv-print-btn,
    .mdv-detail-print-row {
        display: none !important;
    }
    
    .mdv-table-wrap {
        border: none;
        box-shadow: none;
    }
    
    .mdv-table {
        font-size: 8px;
    }
    
    .mdv-table th,
    .mdv-table td {
        padding: 4px;
    }

    .mdv-table th {
        position: static !important;
    }
    
    .mdv-table tbody tr:hover {
        background-color: transparent;
    }
    
    .mdv-detail-table th,
    .mdv-detail-table td {
        padding: 8px 12px;
    }
}

/* ===========================
   Utility Classes
   =========================== */
.mdv-hidden {
    display: none !important;
}

.mdv-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}
