/* ═══════════════════════════════════════════════════════════════════════════
   Caye Service Portal — shared stylesheet
   Used by both the CAYE and Knotel portals.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
    padding: 24px 16px;
    color: #333;
}

a { color: inherit; }

/* ── Outer card ───────────────────────────────────────────────────────────── */
.portal-wrap {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    overflow: hidden;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.portal-wrap.narrow { max-width: 640px; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.portal-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    padding: 36px 30px;
    text-align: center;
}

.portal-header h1 {
    color: #fff;
    font-size: 24px;
    font-weight: 300;
    margin-top: 20px;
    letter-spacing: .4px;
}

.logo-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.logo-wcc    { max-width: 200px; height: auto; }
.logo-caye   { max-width: 180px; height: auto; filter: brightness(0) invert(1); }
.logo-knotel { max-width: 120px; height: auto; filter: brightness(0) invert(1); }

/* ── Toolbar / filter bar ─────────────────────────────────────────────────── */
.portal-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

/* ── Page body ────────────────────────────────────────────────────────────── */
.portal-body { padding: 34px 28px; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.portal-footer {
    background: #f8f9fa;
    border-top: 1px solid #e1e8ed;
    padding: 16px 28px;
    text-align: center;
    font-size: 13px;
    color: #999;
}

/* ── Alert / flash messages ───────────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 22px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-error   { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }

/* ── Form elements ────────────────────────────────────────────────────────── */
.form-row { margin-bottom: 22px; }
.form-row.half { display: flex; gap: 16px; }
.form-row.half .form-group { flex: 1; }
.form-group { position: relative; }

label {
    display: block;
    margin-bottom: 7px;
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.req { color: #e74c3c; margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 13px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #f8f9fa;
    color: #333;
    transition: border-color .2s, box-shadow .2s, background .2s;
    appearance: auto;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #333;
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
}

textarea { min-height: 130px; resize: vertical; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: transform .2s, box-shadow .2s;
    line-height: 1.2;
}

.btn-primary {
    background: linear-gradient(135deg, #333 0%, #1a1a1a 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .22);
}

.btn-sm       { padding: 10px 20px; font-size: 14px; border-radius: 8px; }
.btn-block    { width: 100%; margin-top: 10px; text-align: center; }
.btn-back     { border-radius: 8px; }

/* ── Status badges ────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 5px 13px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.badge-new       { background: #e3f2fd; color: #1565c0; }
.badge-working   { background: #fff3e0; color: #e65100; }
.badge-escalated { background: #ffebee; color: #c62828; }
.badge-closed    { background: #e8f5e9; color: #2e7d32; }
.badge-default   { background: #f5f5f5; color: #555;    }

/* ── Data table ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

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

.data-table th,
.data-table td {
    padding: 13px 16px;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
    font-size: 14px;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.data-table th:hover     { background: #edf0f3; }
.data-table th .sort-icon { margin-left: 4px; font-size: 11px; color: #888; }

.data-table tr:nth-child(even) td { background: #fafbfc; }
.data-table tr:hover td { background: #f0f4f8; }

.data-table a            { text-decoration: none; font-weight: 600; color: #333; }
.data-table a:hover      { color: #1565c0; text-decoration: underline; }

/* ── Empty / loading states ───────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}
.empty-state h3 { color: #555; margin-bottom: 8px; }
.loading-text   { font-style: italic; color: #888; font-size: 14px; display: none; }

/* ── Case detail – metadata grid ─────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.detail-card {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 16px 18px;
}

.detail-card .lbl {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 5px;
}

.detail-card .val { font-size: 15px; color: #333; line-height: 1.4; }

/* ── Case title block ─────────────────────────────────────────────────────── */
.case-header    { margin-bottom: 28px; padding-bottom: 18px; border-bottom: 2px solid #e1e8ed; }
.case-number    { font-size: 22px; font-weight: 600; color: #333; margin-bottom: 6px; }
.case-subject   { font-size: 16px; color: #555; margin-bottom: 14px; line-height: 1.4; }

/* ── Section headings ─────────────────────────────────────────────────────── */
.section-heading {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e1e8ed;
}

/* ── Pre-formatted text (description / comment body) ─────────────────────── */
.text-block {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 18px;
    color: #555;
    line-height: 1.65;
    white-space: pre-wrap;
    font-size: 14px;
    margin-bottom: 28px;
    word-break: break-word;
}

/* ── Comment thread ───────────────────────────────────────────────────────── */
.comment-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 28px; }

.comment-item {
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    overflow: hidden;
}

.comment-item.from-customer { border-left: 3px solid #1565c0; }
.comment-item.from-team     { border-left: 3px solid #2e7d32; }

.comment-meta {
    background: #f8f9fa;
    padding: 9px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #e1e8ed;
    gap: 10px;
    flex-wrap: wrap;
}

.comment-meta .author { font-weight: 600; color: #333; }
.comment-meta .date   { white-space: nowrap; }

.comment-body {
    padding: 14px 16px;
    white-space: pre-wrap;
    font-size: 14px;
    color: #444;
    line-height: 1.6;
    word-break: break-word;
}

/* ── Reply form ───────────────────────────────────────────────────────────── */
.reply-form {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 24px;
    margin-top: 8px;
}

/* ── Filter controls ──────────────────────────────────────────────────────── */
.filter-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-group label { margin-bottom: 0; }
.filter-group select { width: auto; padding: 9px 14px; font-size: 14px; border-radius: 8px; }
.case-count { font-size: 14px; color: #666; }

/* ── Thank-you page centring ──────────────────────────────────────────────── */
.thankyou-body {
    min-height: 55vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
    padding: 48px 28px;
}

.thankyou-body h2  { font-size: 28px; font-weight: 300; color: #333; }
.thankyou-body p   { font-size: 16px; color: #666; line-height: 1.6; max-width: 500px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    body                       { padding: 10px 8px; }
    .portal-header             { padding: 24px 18px; }
    .portal-header h1          { font-size: 20px; }
    .portal-body               { padding: 22px 16px; }
    .portal-toolbar            { padding: 12px 16px; }
    .portal-footer             { padding: 14px 16px; }
    .logo-wcc                  { max-width: 150px; }
    .form-row.half             { flex-direction: column; gap: 0; }
    .detail-grid               { grid-template-columns: 1fr; }
    .data-table th,
    .data-table td             { padding: 10px 10px; font-size: 13px; }
}
