/* ═══════════════════════════════════════════════════════
   Team Report Elite — Frontend Admin Pages CSS
   Fully responsive, advanced, interactive design
   ══════════════════════════════════════════════════════*/

/* ── Reset ── */
.trp-fe-wrap *,
.trp-fe-wrap *::before,
.trp-fe-wrap *::after { box-sizing: border-box; }

/* ── Outer container ── */
.trp-fe-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #1f2937;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 0 50px;
}

/* ══════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════*/
.trp-fe-header {
    background: linear-gradient(135deg, #6a1b9a 0%, #1565c0 100%);
    color: #fff;
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(106,27,154,0.25);
}
.trp-fe-header::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 180px; height: 180px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}
.trp-fe-header::after {
    content: '';
    position: absolute;
    bottom: -60px; right: 80px;
    width: 130px; height: 130px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}
.trp-fe-header h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.3px;
    position: relative;
}
.trp-fe-header p {
    margin: 0;
    opacity: .82;
    font-size: 14px;
    position: relative;
}
.trp-fe-header-meta {
    display: flex;
    gap: 16px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.trp-fe-header-stat {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    backdrop-filter: blur(4px);
}

/* ══════════════════════════════════════════════════════
   NOTICE BOXES
   ══════════════════════════════════════════════════════*/
.trp-fe-notice {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 10px;
}
.trp-fe-notice a { color: inherit; text-decoration: underline; }
.trp-fe-notice.success { background: #d1fae5; border: 1px solid #6ee7b7; color: #065f46; }
.trp-fe-notice.warning { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; }
.trp-fe-notice.error   { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }

/* ══════════════════════════════════════════════════════
   FILTER BAR — ALL REPORTS  (redesigned)
   ══════════════════════════════════════════════════════*/
.trp-fe-filter-bar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 28px;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.trp-fe-filter-bar .trp-fe-filter-title {
    font-size: 13px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.trp-fe-filter-bar .trp-fe-filter-title::before {
    content: '';
    display: inline-block;
    width: 3px; height: 14px;
    background: linear-gradient(135deg,#6a1b9a,#1565c0);
    border-radius: 2px;
}

/* Primary filter inputs row */
.trp-fe-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.trp-fe-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 150px;
    min-width: 130px;
}
.trp-fe-filter-group label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6b7280;
}
.trp-fe-filter-group select,
.trp-fe-filter-group input[type="date"],
.trp-fe-filter-row select,
.trp-fe-filter-row input[type="date"] {
    padding: 9px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    background: #f9fafb;
    color: #1f2937;
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath fill='%236b7280' d='M6 7L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}
.trp-fe-filter-group input[type="date"],
.trp-fe-filter-row input[type="date"] {
    background-image: none;
    padding-right: 12px;
}
.trp-fe-filter-group select:focus,
.trp-fe-filter-group input:focus,
.trp-fe-filter-row select:focus,
.trp-fe-filter-row input:focus {
    outline: none;
    border-color: #6a1b9a;
    box-shadow: 0 0 0 3px rgba(106,27,154,0.1);
    background: #fff;
}

/* Action buttons row */
.trp-fe-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e5e7eb;
}
.trp-fe-filter-divider {
    width: 1px;
    height: 28px;
    background: #e5e7eb;
    margin: 0 4px;
}

/* ══════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════*/
.trp-fe-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
    transition: all .2s;
    letter-spacing: .1px;
}
.trp-fe-btn.primary {
    background: linear-gradient(135deg, #6a1b9a, #1565c0);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(106,27,154,0.3);
}
.trp-fe-btn.primary:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 5px 15px rgba(106,27,154,0.35); color:#fff; }
.trp-fe-btn.secondary { background: #f3f4f6; color: #374151; border-color: #e5e7eb; }
.trp-fe-btn.secondary:hover { background: #e5e7eb; }
.trp-fe-btn.outline { background: #fff; color: #6a1b9a; border-color: #6a1b9a; }
.trp-fe-btn.outline:hover { background: #f3e8ff; }
.trp-fe-btn.outline-blue { background: #fff; color: #1565c0; border-color: #1565c0; }
.trp-fe-btn.outline-blue:hover { background: #eff6ff; }
.trp-fe-btn.danger { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }
.trp-fe-btn.danger:hover { background: #fee2e2; }
.trp-fe-btn.sm { padding: 6px 13px; font-size: 12px; }

/* ══════════════════════════════════════════════════════
   USER BLOCKS
   ══════════════════════════════════════════════════════*/
.trp-fe-user-block {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    transition: box-shadow .2s;
}
.trp-fe-user-block:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.trp-fe-user-header {
    background: linear-gradient(90deg, #f3f4f6 0%, #fff 100%);
    padding: 13px 20px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 15px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}
.trp-fe-user-avatar-circle {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6a1b9a, #1565c0);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.trp-fe-user-name { font-weight: 700; }
.trp-fe-user-badge {
    margin-left: auto;
    background: #f3e8ff;
    color: #6a1b9a;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}
.trp-fe-empty {
    padding: 20px 20px;
    color: #9ca3af;
    font-style: italic;
    margin: 0;
    text-align: center;
}

/* ══════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════*/
.trp-fe-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.trp-fe-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}
.trp-fe-table th {
    background: linear-gradient(135deg, #6a1b9a, #1565c0);
    color: #fff;
    padding: 11px 14px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: .3px;
    text-transform: uppercase;
}
.trp-fe-table th:first-child { border-radius: 0; }
.trp-fe-table td {
    border-bottom: 1px solid #f3f4f6;
    padding: 10px 14px;
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
    transition: background .15s;
}
.trp-fe-table tbody tr:hover td { background: #faf5ff; }
.trp-fe-table tbody tr:last-child td { border-bottom: none; }
.trp-fe-wk-cell {
    font-weight: 700;
    background: #fafafa;
    text-align: center;
    color: #6a1b9a;
    white-space: nowrap;
    font-size: 12px;
}
.trp-fe-day-cell {
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    color: #374151;
    font-size: 12px;
}
.trp-fe-link { color: #1565c0; word-break: break-all; font-size: 12px; }
.trp-fe-link:hover { color: #6a1b9a; text-decoration: underline; }
.trp-fe-summary-cell { line-height: 1.6; }
.trp-fe-summary-cell p { margin: 0 0 6px; }
.trp-fe-action-cell { white-space: nowrap; }

/* ── Action buttons in table ── */
.trp-fe-act-btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid transparent;
    margin: 2px;
    transition: all .2s;
    letter-spacing: .2px;
}
.trp-fe-act-btn.edit   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.trp-fe-act-btn.delete { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.trp-fe-act-btn:hover  { opacity: .8; transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════*/
.trp-fe-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 18px;
    border-top: 1px solid #f3f4f6;
    background: #fafafa;
    align-items: center;
}
.trp-fe-pagination-label {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-right: 4px;
}
.trp-fe-page-btn {
    padding: 5px 13px;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    color: #374151;
}
.trp-fe-page-btn.active {
    background: linear-gradient(135deg,#6a1b9a,#1565c0);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(106,27,154,0.3);
}
.trp-fe-page-btn:hover:not(.active) { background: #f3f4f6; border-color: #d1d5db; }

/* ══════════════════════════════════════════════════════
   EDIT MODAL
   ══════════════════════════════════════════════════════*/
.trp-fe-modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}
.trp-fe-modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 24px 80px rgba(0,0,0,.25);
    animation: trpModalIn .2s ease;
}
@keyframes trpModalIn {
    from { opacity:0; transform: scale(.95) translateY(10px); }
    to   { opacity:1; transform: scale(1)  translateY(0); }
}
.trp-fe-modal-close {
    position: absolute;
    top: 14px; right: 18px;
    background: #f3f4f6;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.trp-fe-modal-close:hover { background: #fee2e2; color: #dc2626; }
.trp-fe-modal-box h3 { margin: 0 0 22px; font-size: 18px; font-weight: 800; color:#1f2937; }
.trp-fe-modal-box label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6b7280;
    margin-bottom: 14px;
}
.trp-fe-modal-box input[type="text"],
.trp-fe-modal-box input[type="url"],
.trp-fe-modal-box textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 13px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
}
.trp-fe-modal-box input:focus,
.trp-fe-modal-box textarea:focus {
    outline: none;
    border-color: #6a1b9a;
    box-shadow: 0 0 0 3px rgba(106,27,154,0.1);
}
.trp-fe-modal-box textarea { resize: vertical; min-height: 110px; }
.trp-fe-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

/* ══════════════════════════════════════════════════════
   WEEK MANAGEMENT WRAP
   ══════════════════════════════════════════════════════*/
.trp-fe-week-wrap .wrap { margin: 0; padding: 0; }
.trp-fe-week-wrap h1 { font-size: 20px; }

/* ── Fix bulk controls flex layout on frontend ── */
.trp-fe-week-wrap .trp-wrap {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin-top: 0;
}
.trp-fe-week-wrap .trp-bulk-controls {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px !important;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px 20px !important;
    margin-bottom: 20px;
}
.trp-fe-week-wrap .trp-bulk-controls strong {
    white-space: nowrap;
    color: #374151;
    font-size: 13px;
}
.trp-fe-week-wrap .trp-bulk-controls input[type="date"] {
    flex: 0 0 auto;
    min-width: 150px;
    padding: 7px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
}
.trp-fe-week-wrap .trp-bulk-action {
    flex: 0 0 auto;
    white-space: nowrap;
}
.trp-fe-week-wrap .trp-heading {
    padding: 0;
    margin-bottom: 8px;
}
.trp-fe-week-wrap .trp-description {
    padding: 0;
    margin-bottom: 18px;
}

/* ══════════════════════════════════════════════════════
   ROLE CHIP GRID
   ══════════════════════════════════════════════════════*/
.trp-fe-roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.trp-fe-role-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    transition: all .2s;
}
.trp-fe-role-chip:hover { background: #f3e8ff; border-color: #a78bfa; }
.trp-fe-role-chip input[type="checkbox"] {
    accent-color: #6a1b9a;
    width: 15px; height: 15px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   SETTINGS TABLE
   ══════════════════════════════════════════════════════*/
.trp-fe-settings-table {
    width: 100%;
    max-width: 500px;
    border-collapse: collapse;
}
.trp-fe-settings-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    width: 200px;
}
.trp-fe-settings-table td {
    padding: 8px 14px;
    border-bottom: 1px solid #f3f4f6;
}
.trp-fe-settings-table input[type="color"] {
    width: 48px; height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
}

/* ══════════════════════════════════════════════════════
   SUMMARY STATS ROW (All Reports page)
   ══════════════════════════════════════════════════════*/
.trp-fe-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}
.trp-fe-stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 22px;
    flex: 1 1 160px;
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.trp-fe-stat-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}
.trp-fe-stat-body { display: flex; flex-direction: column; }
.trp-fe-stat-value { font-size: 20px; font-weight: 800; color: #1f2937; line-height: 1; }
.trp-fe-stat-label { font-size: 11px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: .5px; margin-top: 3px; }

/* ══════════════════════════════════════════════════════
   FORM
   ══════════════════════════════════════════════════════*/
.trp-fe-form { max-width: 700px; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════*/
@media (max-width: 768px) {
    .trp-fe-header { padding: 20px; }
    .trp-fe-filter-bar { padding: 16px; }
    .trp-fe-filter-row { gap: 8px; }
    .trp-fe-filter-group { flex: 1 1 130px; }
    .trp-fe-stats-row { gap: 10px; }
    .trp-fe-stat-card { flex: 1 1 120px; padding: 12px 14px; }
}
@media (max-width: 600px) {
    .trp-fe-header h2 { font-size: 18px; }
    .trp-fe-filter-group { flex: 1 1 100%; }
    .trp-fe-filter-actions { flex-direction: column; align-items: stretch; }
    .trp-fe-btn { justify-content: center; }
    .trp-fe-roles-grid { grid-template-columns: 1fr 1fr; }
    .trp-fe-modal-box { padding: 22px 16px; }
    .trp-fe-settings-table th { width: 140px; font-size: 13px; }
    .trp-fe-filter-divider { display: none; }
}
@media (max-width: 400px) {
    .trp-fe-roles-grid { grid-template-columns: 1fr; }
}
