/**
 * Agent Dashboard — Specific Overrides + Responsive Layout
 * Sits on top of manager-portal.css.
 * Extracted from widget-dashboard.php inline <style> block.
 */

.map-agent-section {
    background: #fff;
    border: 1px solid var(--portal-border, #e1e4e8);
    border-radius: 10px;
    padding: 22px 25px;
    margin-bottom: 20px;
    box-shadow: var(--portal-shadow, 0 4px 15px rgba(0,0,0,0.05));
}

.map-agent-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #95a5a6;
    margin: 0 0 16px 0;
}

.map-agent-sidebar-avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    margin: 0 0 14px;
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.18);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
}

.map-agent-sidebar-avatar img,
.map-profile-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.map-profile-photo-editor {
    display: flex;
    gap: 22px;
    align-items: center;
}

.map-profile-photo-preview {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    flex: 0 0 112px;
    background: #eef5fb;
    border: 1px solid #dce6f0;
    color: var(--portal-primary, #2c3e50);
    font-size: 26px;
    font-weight: 800;
}

.map-profile-photo-controls {
    min-width: 0;
}

.map-profile-photo-controls p {
    margin: 0 0 10px;
    color: #7f8c8d;
    font-size: 13px;
}

.map-profile-photo-current a {
    color: var(--portal-primary, #2c3e50);
    font-weight: 700;
}

.map-profile-photo-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
    color: #95a5a6;
    font-size: 12px;
}

.map-comp-card {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 22px;
    background: #fff;
    border: 1px solid var(--portal-border, #e1e4e8);
    border-radius: 12px;
    padding: 22px;
    box-shadow: var(--portal-shadow, 0 4px 15px rgba(0,0,0,0.05));
}

.map-comp-card-compact {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 18px;
    padding: 18px 22px;
}

.map-comp-card-image {
    align-self: start;
}

.map-comp-image-btn,
.map-comp-image-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    border: 1px solid #dce3ea;
    background: #f5f7fa;
    overflow: hidden;
    padding: 0;
    display: grid;
    place-items: center;
}

.map-comp-image-btn {
    cursor: pointer;
}

.map-comp-image-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.18s ease;
}

.map-comp-image-btn:hover img {
    transform: scale(1.04);
}

.map-comp-image-placeholder span {
    color: #95a5a6;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.map-comp-card-body {
    min-width: 0;
}

.map-comp-image-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    background: rgba(20, 31, 43, 0.72);
    padding: 24px;
}

.map-comp-image-modal-inner {
    position: relative;
    width: min(760px, 92vw);
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.map-comp-image-modal-inner img {
    width: 100%;
    max-height: 76vh;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    background: #f5f7fa;
}

.map-comp-image-modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #2c3e50;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.map-comp-image-modal-title {
    margin-top: 10px;
    color: #5f7190;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

/* Submissions table inside agent dashboard */
.map-portal-table td,
.map-portal-table th {
    padding: 12px 14px;
}

.map-agent-submissions-table {
    table-layout: fixed;
}

.map-agent-submissions-table .map-col-case {
    width: 36%;
    min-width: 210px;
}

.map-agent-submissions-table .map-col-finance {
    width: 20%;
}

.map-agent-submissions-table .map-col-combined-status {
    width: 22%;
}

.map-agent-submissions-table .map-col-date {
    width: 12%;
}

.map-agent-submissions-table .map-col-action {
    width: 150px;
    text-align: right;
}

.map-agent-submissions-table td {
    vertical-align: middle;
    overflow-wrap: normal;
    padding-top: 10px;
    padding-bottom: 10px;
}

.map-agent-submissions-table .map-case-title {
    display: block;
    color: #5f7190;
    line-height: 1.35;
    margin-bottom: 6px;
}

.map-role-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
}

.map-role-badge-main {
    background: #eaf4fd;
    color: #2980b9;
}

.map-role-badge-co {
    background: #f1f2f6;
    color: #7f8c8d;
}

.map-agent-submissions-table .map-col-finance span {
    color: #7f8c8d;
    font-size: 12px;
}

.map-action-stack {
    display: inline-flex;
    flex-direction: column;
    gap: 7px;
    align-items: stretch;
    min-width: 118px;
}

.map-action-stack .map-btn-small {
    width: 100%;
    padding: 7px 10px;
    font-size: 11px;
    line-height: 1.2;
}

.map-docs-view-btn {
    background: #f5f7fa !important;
    border: 1px solid #dce3ea !important;
    color: #2c3e50 !important;
}

.map-case-view-panel {
    padding: 22px 26px;
    background: #fbfcfe;
}

.map-case-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.map-case-detail-card {
    background: #fff;
    border: 1px solid #e8edf2;
    border-radius: 8px;
    padding: 16px 18px;
}

.map-case-detail-card h4 {
    margin: 0 0 12px;
    color: #95a5a6;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.map-case-detail-item {
    display: grid;
    grid-template-columns: minmax(170px, 0.35fr) minmax(0, 1fr);
    gap: 18px;
    padding: 7px 0;
    border-top: 1px solid #f0f3f6;
}

.map-case-detail-item:first-of-type {
    border-top: 0;
}

.map-case-detail-item span {
    color: #7f8c8d;
    font-size: 12px;
}

.map-case-detail-item strong {
    color: #5f7190;
    font-size: 12px;
    line-height: 1.45;
}

.map-case-solicitors-card,
.map-case-documents-card {
    margin-top: 14px;
}

.map-case-solicitor-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

.map-case-documents-card .map-docs-panel {
    padding: 0;
}

.map-approved-doc-note {
    margin: 0 0 14px;
    color: #7f8c8d;
    font-size: 12px;
    line-height: 1.5;
}

.map-file-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.map-file-picker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 7px;
    border: 1px solid #ccd5df;
    background: #f8fafc;
    color: #2c3e50;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    box-sizing: border-box;
}

.map-file-picker:hover {
    background: #eef3f8;
}

.map-file-picker input {
    display: none;
}

.map-file-picker-small {
    min-height: 30px;
    padding: 6px 10px;
    font-size: 11px;
}

.map-file-picked-text {
    color: #7f8c8d;
    font-size: 12px;
    line-height: 1.3;
}

.map-edit-documents-panel .map-add-doc-form {
    padding-top: 2px;
}

.map-doc-empty {
    margin: 0 0 14px;
    color: #a7b1c1;
    font-size: 14px;
}

.map-doc-upload-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 14px;
    align-items: stretch;
    margin-top: 12px;
}

.map-doc-upload-zone {
    display: grid;
    gap: 5px;
    align-content: center;
    min-height: 86px;
    padding: 16px 18px;
    border: 1.5px dashed #b8c6d6;
    border-radius: 10px;
    background: #f8fbfe;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.map-doc-upload-zone:hover,
.map-doc-upload-zone.is-dragging {
    border-color: #244b78;
    background: #eef6ff;
    box-shadow: 0 6px 18px rgba(36,75,120,0.08);
}

.map-doc-upload-zone input {
    display: none;
}

.map-doc-upload-title {
    color: #2c3e50;
    font-size: 13px;
    font-weight: 800;
}

.map-doc-upload-hint {
    color: #95a5a6;
    font-size: 11px;
}

.map-doc-upload-zone .map-file-picked-text {
    color: #5f7190;
    font-weight: 700;
}

.map-doc-upload-btn {
    align-self: center;
    min-width: 150px;
    min-height: 42px;
}

#map-cancel-edit-btn {
    background: #f1f2f6 !important;
    color: #7f8c8d !important;
    border: 1px solid #dcdde1 !important;
}

.map-solicitor-rows {
    display: grid;
    gap: 14px;
}

.map-solicitor-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
    gap: 16px;
    align-items: end;
}

.map-solicitor-row .map-form-group {
    margin-bottom: 0;
}

/* ─── Sidebar hover feedback ─────────────────────────────── */
.map-sidebar-nav li[data-tab]:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

/* ─── Responsive layout ──────────────────────────────────── */

/* Tablet: collapse sidebar to icon strip */
@media (max-width: 900px) {
    .map-portal-wrapper {
        border-radius: 8px;
    }

    .map-portal-sidebar {
        width: 60px;
        min-width: 60px;
    }

    .map-sidebar-header {
        padding: 20px 10px;
        text-align: center;
    }

    .map-agent-sidebar-avatar {
        width: 38px;
        height: 38px;
        margin: 0 auto;
        font-size: 12px;
    }

    /* Hide the text name, keep the header visible */
    .map-sidebar-header h3,
    .map-sidebar-header p {
        display: none;
    }

    .map-sidebar-nav li {
        padding: 16px 0;
        justify-content: center;
        border-left: none;
        border-bottom: 3px solid transparent;
        flex-direction: column;
        gap: 2px;
        font-size: 0; /* hide label text */
    }

    .map-sidebar-nav li span.dashicons {
        margin-right: 0;
        font-size: 20px;
    }

    .map-sidebar-nav li.active {
        border-left: none;
        border-bottom-color: var(--portal-hover);
        background: rgba(255,255,255,0.08);
    }

    .map-sidebar-footer {
        padding: 10px 6px;
    }

    .map-logout-btn span:not(.dashicons) {
        display: none;
    }

    .map-workspace-header {
        padding: 18px 20px;
    }

    #map-workspace-content {
        padding: 20px;
    }

    .map-registration-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .map-stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: stack sidebar on top of content */
@media (max-width: 600px) {
    .map-portal-wrapper {
        flex-direction: column;
        border-radius: 0;
        box-shadow: none;
    }

    .map-portal-sidebar {
        width: 100%;
        min-width: 0;
        flex-direction: column;
    }

    /* Hide the greeting, show only the nav */
    .map-sidebar-header {
        display: none;
    }

    .map-sidebar-nav ul {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0;
        gap: 0;
        white-space: nowrap;
    }

    .map-sidebar-nav li {
        flex: 0 0 auto;
        flex-direction: column;
        gap: 3px;
        padding: 12px 14px;
        font-size: 10px;
        border-left: none;
        border-bottom: 3px solid transparent;
        justify-content: center;
        align-items: center;
    }

    .map-sidebar-nav li span.dashicons {
        margin-right: 0;
        font-size: 18px;
    }

    .map-sidebar-nav li.active {
        border-left: none;
        border-bottom-color: var(--portal-hover);
        background: rgba(255,255,255,0.1);
    }

    .map-sidebar-footer {
        display: none; /* logout button moved inline elsewhere on mobile */
    }

    .map-portal-main {
        overflow-y: visible;
    }

    .map-workspace-header {
        padding: 16px 16px;
    }

    .map-workspace-header h2 {
        font-size: 1.2rem;
    }

    #map-workspace-content {
        padding: 16px;
    }

    .map-stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .map-registration-grid {
        grid-template-columns: 1fr !important;
    }

    .map-profile-photo-editor {
        align-items: flex-start;
        flex-direction: column;
    }

    .map-comp-card,
    .map-comp-card-compact {
        grid-template-columns: 1fr;
    }

    .map-comp-card-image {
        max-width: 260px;
        width: 100%;
    }

    .map-solicitor-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .map-portal-table {
        font-size: 12px;
    }

    .map-agent-submissions-table {
        table-layout: auto;
        min-width: 760px;
    }

    .map-doc-upload-form {
        grid-template-columns: 1fr;
    }

    .map-doc-upload-btn {
        width: 100%;
    }

    .map-case-view-panel {
        padding: 16px;
    }

    .map-case-detail-item {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .map-portal-table th,
    .map-portal-table td {
        padding: 8px 10px;
    }
}
