/* ════════════════════════════════════════════════════════════════════════
   FiberX Ticketing System
   The same design language as the Dashboard: Inter, the purple/orange pair,
   white cards on a tinted gradient with the concentric-ring backdrop.
   Prefix: mp-
   ════════════════════════════════════════════════════════════════════════ */

:root {
    --fx-primary-orange: #FF7B53;
    --fx-secondary-orange: #FF9575;
    --fx-purple: #4B3E7B;
    --fx-light-purple: #7B68B8;
    --fx-dark: #2D2350;

    --fx-bg-1: #E8E5F0;
    --fx-bg-2: #F5F3F8;
    --fx-bg-3: #FFF5F0;

    --fx-text: #2D2350;
    --fx-muted: #6B7280;
    --fx-border: rgba(0, 0, 0, .06);
    --fx-card: #ffffff;

    --fx-radius-lg: 22px;
    --fx-radius: 14px;
    --fx-radius-sm: 10px;

    --fx-shadow-lg: 0 30px 80px rgba(0, 0, 0, .10);
    --fx-shadow: 0 18px 55px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--fx-text);
    background: linear-gradient(135deg, var(--fx-bg-1) 0%, var(--fx-bg-2) 50%, var(--fx-bg-3) 100%);
}

/* Alpine hides elements with x-cloak until it has initialised, which stops the
   whole markup flashing on screen before the first view is chosen. */
[x-cloak] { display: none !important; }

/* ── Ring backdrop, matching the Dashboard's ── */
.mp-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.mp-wave {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    opacity: .30;
}

.mp-wave-1 {
    background: repeating-radial-gradient(circle at 50% 50%,
        transparent 0, transparent 30px,
        rgba(123, 104, 184, .12) 32px, rgba(123, 104, 184, .12) 34px);
}

.mp-wave-2 {
    background: repeating-radial-gradient(circle at 50% 50%,
        transparent 0, transparent 40px,
        rgba(255, 123, 83, .10) 42px, rgba(255, 123, 83, .10) 44px);
}

.mp-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* ════════════════════════════════════════════════════════════════════════
   Auth screens (login / first-time password change)
   ════════════════════════════════════════════════════════════════════════ */

.mp-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.mp-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--fx-card);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-lg);
    box-shadow: var(--fx-shadow-lg);
    padding: 34px 30px;
}

.mp-auth-logo {
    display: block;
    height: 46px;
    margin: 0 auto 20px;
}

.mp-auth-title {
    font-size: 21px;
    font-weight: 900;
    text-align: center;
    color: var(--fx-dark);
    margin: 0 0 6px;
}

.mp-auth-sub {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    color: var(--fx-muted);
    margin: 0 0 24px;
    line-height: 1.5;
}

/* ════════════════════════════════════════════════════════════════════════
   Form controls
   ════════════════════════════════════════════════════════════════════════ */

.mp-field { margin-bottom: 16px; }

.mp-label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--fx-dark);
    margin-bottom: 7px;
    letter-spacing: .2px;
}

.mp-input,
.mp-select {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid rgba(75, 62, 123, .20);
    border-radius: var(--fx-radius-sm);
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--fx-text);
    transition: border-color .15s, box-shadow .15s;
}

.mp-input::placeholder { color: #9CA3AF; font-weight: 500; }

.mp-input:focus,
.mp-select:focus {
    outline: none;
    border-color: var(--fx-purple);
    box-shadow: 0 0 0 3px rgba(75, 62, 123, .12);
}

.mp-hint {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #9CA3AF;
    margin-top: 5px;
}

/* ── Buttons ── */
.mp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border: none;
    border-radius: var(--fx-radius-sm);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 900;
    letter-spacing: .4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform .12s, box-shadow .15s, opacity .15s;
}

.mp-btn:disabled { opacity: .6; cursor: not-allowed; }
.mp-btn:not(:disabled):hover { transform: translateY(-1px); }

.mp-btn-primary {
    background: linear-gradient(135deg, var(--fx-primary-orange), var(--fx-secondary-orange));
    color: #fff;
    box-shadow: 0 10px 24px rgba(255, 123, 83, .28);
}

.mp-btn-purple {
    background: var(--fx-purple);
    color: #fff;
    box-shadow: 0 10px 24px rgba(75, 62, 123, .24);
}

.mp-btn-ghost {
    background: #fff;
    color: var(--fx-purple);
    border: 1px solid rgba(75, 62, 123, .24);
}

.mp-btn-block { width: 100%; }

/* ── Inline messages ── */
.mp-error,
.mp-success {
    border-radius: var(--fx-radius-sm);
    padding: 10px 13px;
    font-size: 12.5px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.45;
}

.mp-error {
    background: rgba(242, 28, 13, .08);
    border: 1px solid rgba(242, 28, 13, .24);
    color: #B91C1C;
}

.mp-success {
    background: rgba(16, 185, 129, .09);
    border: 1px solid rgba(16, 185, 129, .26);
    color: #047857;
}

/* ════════════════════════════════════════════════════════════════════════
   Top app bar
   ════════════════════════════════════════════════════════════════════════ */

.mp-appbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 22px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--fx-border);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .05);
}

.mp-appbar-logo { height: 32px; }

.mp-appbar-titles { line-height: 1.2; }

.mp-appbar-title {
    font-size: 15px;
    font-weight: 900;
    color: var(--fx-dark);
}

.mp-appbar-sub {
    font-size: 11px;
    font-weight: 700;
    color: var(--fx-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.mp-appbar-spacer { flex: 1; }

.mp-appbar-user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(75, 62, 123, .08);
    border: 1px solid rgba(75, 62, 123, .16);
}

.mp-avatar {
    width: 27px;
    height: 27px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--fx-purple);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
}

.mp-appbar-name {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--fx-dark);
}

.mp-appbar-city {
    font-size: 10.5px;
    font-weight: 900;
    color: #C6472A;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.mp-iconbtn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(75, 62, 123, .18);
    border-radius: 10px;
    background: #fff;
    color: var(--fx-purple);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.mp-iconbtn:hover { background: rgba(75, 62, 123, .08); }

.mp-iconbtn-danger { color: #F21C0D; border-color: rgba(242, 28, 13, .22); }
.mp-iconbtn-danger:hover { background: rgba(242, 28, 13, .07); }

/* ════════════════════════════════════════════════════════════════════════
   Page + cards
   ════════════════════════════════════════════════════════════════════════ */

.mp-page {
    max-width: 1500px;
    margin: 0 auto;
    padding: 20px 22px 44px;
}

.mp-card {
    background: var(--fx-card);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-lg);
    box-shadow: var(--fx-shadow);
    padding: 16px 18px;
    margin-bottom: 14px;
}

.mp-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.mp-toolbar .mp-search { flex: 1 1 280px; min-width: 220px; }
.mp-toolbar .mp-select { flex: 0 1 240px; }

.mp-search {
    padding: 11px 14px;
    border: 1px solid rgba(75, 62, 123, .20);
    border-radius: 999px;
    background: #fff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--fx-text);
}

.mp-search:focus {
    outline: none;
    border-color: var(--fx-purple);
    box-shadow: 0 0 0 3px rgba(75, 62, 123, .12);
}

.mp-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.mp-page-title {
    font-size: 20px;
    font-weight: 900;
    color: var(--fx-dark);
    margin: 0;
}

.mp-page-sub {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--fx-muted);
    margin: 3px 0 0;
}

/* ════════════════════════════════════════════════════════════════════════
   Table
   ════════════════════════════════════════════════════════════════════════ */

.mp-table-wrap {
    background: var(--fx-card);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-lg);
    box-shadow: var(--fx-shadow);
    overflow: hidden;
}

.mp-table-scroll { overflow-x: auto; }

.mp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.mp-table thead th {
    position: sticky;
    top: 0;
    background: #FAFAFC;
    border-bottom: 1px solid rgba(75, 62, 123, .12);
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 900;
    color: var(--fx-purple);
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}

.mp-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, .04);
    font-weight: 600;
    color: #374151;
    vertical-align: middle;
}

.mp-table tbody tr {
    cursor: pointer;
    transition: background .12s;
}

.mp-table tbody tr:hover { background: rgba(75, 62, 123, .04); }

.mp-td-num { color: #9CA3AF; font-weight: 800; width: 52px; }

.mp-td-ticket {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-weight: 800;
    color: var(--fx-purple);
    white-space: nowrap;
}

.mp-td-subject {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    color: var(--fx-dark);
}

.mp-td-date { white-space: nowrap; color: var(--fx-muted); font-size: 12px; }

.mp-empty {
    padding: 46px 20px;
    text-align: center;
    color: var(--fx-muted);
    font-size: 13.5px;
    font-weight: 700;
}

/* ── Chips and badges ── */
.mp-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    background: rgba(75, 62, 123, .08);
    border: 1px solid rgba(75, 62, 123, .18);
    color: var(--fx-purple);
}

.mp-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.mp-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.mp-status-new        { background: rgba(59, 130, 246, .12);  border: 1px solid rgba(59, 130, 246, .3);  color: #1D4ED8; }
.mp-status-inprogress { background: rgba(245, 158, 11, .12);  border: 1px solid rgba(245, 158, 11, .32); color: #B45309; }
.mp-status-onhold     { background: rgba(107, 114, 128, .12); border: 1px solid rgba(107, 114, 128, .3); color: #4B5563; }
.mp-status-resolved   { background: rgba(16, 185, 129, .12);  border: 1px solid rgba(16, 185, 129, .3);  color: #047857; }
.mp-status-closed     { background: rgba(75, 62, 123, .12);   border: 1px solid rgba(75, 62, 123, .3);   color: #4B3E7B; }

.mp-prio {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
}

.mp-prio-low      { color: #059669; }
.mp-prio-medium   { color: #B45309; }
.mp-prio-high     { color: #DC2626; }
.mp-prio-critical { color: #991B1B; }

.mp-dash { color: #D1D5DB; font-weight: 700; }

/* ── Two-line cell: a name with a quieter line beneath it (Claimed By) ── */
.mp-stack {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.3;
}

.mp-stack-main {
    font-weight: 700;
    color: var(--fx-dark);
    white-space: nowrap;
}

.mp-stack-sub {
    font-size: 11px;
    font-weight: 700;
    color: var(--fx-muted);
    white-space: nowrap;
}

.mp-unclaimed {
    color: #9CA3AF;
    font-size: 12px;
    font-weight: 700;
    font-style: italic;
    white-space: nowrap;
}

/* ── Pagination ── */
.mp-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-top: 1px solid rgba(0, 0, 0, .04);
    background: #FAFAFC;
}

.mp-pager-info { font-size: 12px; font-weight: 700; color: var(--fx-muted); }
.mp-pager-info strong { color: var(--fx-dark); font-weight: 900; }

.mp-pager-controls { display: flex; align-items: center; gap: 10px; }

.mp-pager-pill {
    padding: 5px 13px;
    border-radius: 999px;
    background: rgba(75, 62, 123, .10);
    border: 1px solid rgba(75, 62, 123, .18);
    color: var(--fx-purple);
    font-size: 12px;
    font-weight: 900;
}

.mp-pager-btn {
    padding: 6px 13px;
    border: 1px solid rgba(75, 62, 123, .18);
    border-radius: 8px;
    background: #fff;
    color: var(--fx-purple);
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.mp-pager-btn:disabled { opacity: .45; cursor: not-allowed; }
.mp-pager-btn:not(:disabled):hover { background: rgba(75, 62, 123, .07); }

/* ════════════════════════════════════════════════════════════════════════
   Ticket details
   ════════════════════════════════════════════════════════════════════════ */

.mp-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px 20px;
}

.mp-detail-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 9px;
    border-bottom: 1px dashed rgba(0, 0, 0, .06);
}

.mp-detail-key {
    font-size: 10.5px;
    font-weight: 900;
    color: var(--fx-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.mp-detail-val {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--fx-dark);
    word-break: break-word;
}

.mp-section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 900;
    color: var(--fx-purple);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 0 0 14px;
    padding-bottom: 9px;
    border-bottom: 1px solid rgba(75, 62, 123, .12);
}

.mp-longtext {
    font-size: 13.5px;
    font-weight: 600;
    color: #374151;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* ── Comments ── */
.mp-comments { display: flex; flex-direction: column; gap: 11px; }

.mp-comment {
    border: 1px solid rgba(75, 62, 123, .14);
    border-radius: var(--fx-radius);
    background: #FBFAFD;
    padding: 12px 14px;
}

.mp-comment-head {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 7px;
    flex-wrap: wrap;
}

.mp-comment-author {
    font-size: 12.5px;
    font-weight: 900;
    color: var(--fx-dark);
}

.mp-comment-time {
    font-size: 11px;
    font-weight: 700;
    color: var(--fx-muted);
}

.mp-comment-tag {
    font-size: 10px;
    font-weight: 900;
    color: var(--fx-muted);
    text-transform: uppercase;
    letter-spacing: .3px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(107, 114, 128, .1);
}

.mp-comment-body {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* ════════════════════════════════════════════════════════════════════════
   Export dialog
   ════════════════════════════════════════════════════════════════════════ */

.mp-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(45, 35, 80, .42);
    backdrop-filter: blur(3px);
}

.mp-dialog {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--fx-card);
    border-radius: var(--fx-radius-lg);
    box-shadow: 0 40px 90px rgba(0, 0, 0, .28);
    padding: 26px;
}

.mp-dialog-head {
    text-align: center;
    margin-bottom: 20px;
}

.mp-dialog-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 11px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(255, 123, 83, .16), rgba(75, 62, 123, .14));
    color: var(--fx-purple);
}

.mp-dialog-title {
    font-size: 17px;
    font-weight: 900;
    color: var(--fx-dark);
    margin: 0 0 4px;
}

.mp-dialog-sub {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--fx-muted);
    margin: 0;
}

.mp-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.mp-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ── Spinner ── */
.mp-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mp-spin .7s linear infinite;
}

.mp-spinner-purple {
    border-color: rgba(75, 62, 123, .28);
    border-top-color: var(--fx-purple);
}

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

.mp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    padding: 46px 20px;
    color: var(--fx-muted);
    font-size: 13px;
    font-weight: 800;
}

/* ── Narrow screens ── */
@media (max-width: 720px) {
    .mp-appbar { padding: 10px 14px; gap: 10px; }
    .mp-appbar-titles { display: none; }
    .mp-page { padding: 14px 12px 34px; }
    .mp-grid-2 { grid-template-columns: 1fr; }
}
