/**
 * Frontend Schedule Styles
 * Founders Helper – Ngobrol Yuk
 *
 * Compact table layout with responsive horizontal list on mobile.
 */

/* ── Reset & Base ──────────────────────────────────────────────────────────── */

#fh-schedule-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 10px;
}

/* ── Filter Bar ────────────────────────────────────────────────────────────── */

.fh-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.fh-filter-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.fh-filter-btn {
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
    white-space: nowrap;
}

.fh-filter-btn:hover {
    border-color: #111827;
    color: #111827;
}

.fh-filter-btn.active {
    background: #111827;
    color: #ffffff;
    border-color: #111827;
}

.fh-schedule-count {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    white-space: nowrap;
}

/* ── Table Wrapper ─────────────────────────────────────────────────────────── */

.fh-table-wrap {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
}

/* ── Table Header ──────────────────────────────────────────────────────────── */

.fh-table-header {
    display: grid;
    grid-template-columns: 90px 1fr 1fr 130px 115px;
    background: #1e293b;
    padding: 10px 16px;
    gap: 10px;
    align-items: center;
}

.fh-table-header-cell {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.1px;
}

/* ── Table Row ─────────────────────────────────────────────────────────────── */

.fh-table-row {
    display: grid;
    grid-template-columns: 90px 1fr 1fr 130px 115px;
    padding: 9px 16px;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s ease;
}

.fh-table-row:last-child {
    border-bottom: none;
}

.fh-table-row:hover {
    background-color: #f8fafc;
}

/* ── Cell: Waktu ───────────────────────────────────────────────────────────── */

.fh-cell-waktu {
    display: flex;
    flex-direction: column;
}

.fh-cell-time {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.fh-cell-date {
    font-size: 10px;
    font-weight: 500;
    color: #94a3b8;
    margin-top: 1px;
}

/* ── Cell: Siswa ───────────────────────────────────────────────────────────── */

.fh-cell-siswa {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Cell: Tutor ───────────────────────────────────────────────────────────── */

.fh-cell-tutor {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Cell: Bahasa (Language Badge) ─────────────────────────────────────────── */

.fh-lang-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.3;
}

.fh-lang-badge .fh-flag {
    font-size: 12px;
    line-height: 1;
}

/* Language-specific badge colors */
.fh-lang-english   { background: #eff6ff; color: #2563eb; }
.fh-lang-german    { background: #fef3c7; color: #92400e; }
.fh-lang-indonesia { background: #fce7f3; color: #be185d; }
.fh-lang-mandarin  { background: #fee2e2; color: #b91c1c; }
.fh-lang-spanish   { background: #fef9c3; color: #a16207; }

/* ── Cell: Status Badge ────────────────────────────────────────────────────── */

.fh-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.3;
}

.fh-status-badge .fh-status-icon {
    font-size: 10px;
}

/* Status-specific badge colors */
.fh-badge-done      { background: #d1fae5; color: #065f46; }
.fh-badge-ongoing   { background: #ede9fe; color: #5b21b6; }
.fh-badge-next      { background: #dbeafe; color: #1e40af; }
.fh-badge-postponed { background: #fee2e2; color: #991b1b; }

/* ── Section Headers ───────────────────────────────────────────────────────── */

.fh-section-header {
    display: none;
}

/* ── Loading State ─────────────────────────────────────────────────────────── */

.fh-loading-spinner {
    text-align: center;
    padding: 32px 16px;
    color: #9ca3af;
    font-size: 14px;
}

/* ── Hidden utility ────────────────────────────────────────────────────────── */

.fh-hidden {
    display: none !important;
}

/* ── Responsive: Tablet ────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .fh-table-header {
        grid-template-columns: 80px 1fr 1fr 110px 100px;
        padding: 8px 12px;
        gap: 8px;
    }

    .fh-table-row {
        grid-template-columns: 80px 1fr 1fr 110px 100px;
        padding: 8px 12px;
        gap: 8px;
    }

    .fh-cell-time {
        font-size: 13px;
    }

    .fh-cell-siswa,
    .fh-cell-tutor {
        font-size: 12px;
    }
}

/* ── Responsive: Mobile ────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    #fh-schedule-container {
        padding: 0 6px;
    }

    .fh-filter-bar {
        gap: 6px;
        margin-bottom: 8px;
    }

    .fh-filter-buttons {
        gap: 4px;
    }

    .fh-filter-btn {
        padding: 4px 10px;
        font-size: 11px;
    }

    .fh-schedule-count {
        font-size: 11px;
    }

    .fh-table-header {
        display: none;
    }

    .fh-table-wrap {
        border: none;
        border-radius: 0;
        background: transparent;
    }

    /*
     * Mobile: compact horizontal row layout (no stacking).
     * Row 1: [time + date] [student] [status badge]
     * Row 2: [tutor] [language badge]
     */
    .fh-table-row {
        display: grid;
        grid-template-columns: 62px 1fr auto;
        grid-template-rows: auto auto;
        gap: 2px 8px;
        background: #fff;
        border-bottom: 1px solid #f1f5f9;
        border-radius: 0;
        padding: 8px 10px;
        margin-bottom: 0;
        box-shadow: none;
    }

    .fh-table-row:first-of-type {
        border-top: 1px solid #e5e7eb;
    }

    .fh-table-row:hover {
        background: #f8fafc;
        box-shadow: none;
    }

    /* Row 1, Col 1: Time */
    .fh-cell-waktu {
        grid-column: 1;
        grid-row: 1 / 3;
        align-self: center;
    }

    .fh-cell-time {
        font-size: 14px;
        font-weight: 800;
    }

    .fh-cell-date {
        font-size: 9px;
    }

    /* Row 1, Col 2: Student name */
    .fh-cell-siswa {
        grid-column: 2;
        grid-row: 1;
        font-size: 13px;
        font-weight: 600;
        align-self: end;
        line-height: 1.3;
    }

    /* Row 2, Col 2: Tutor name */
    .fh-cell-tutor {
        grid-column: 2;
        grid-row: 2;
        font-size: 11px;
        color: #64748b;
        align-self: start;
        line-height: 1.3;
    }

    /* Row 1, Col 3: Status badge */
    .fh-cell-status-wrap {
        grid-column: 3;
        grid-row: 1;
        display: flex;
        justify-content: flex-end;
        align-self: end;
    }

    /* Row 2, Col 3: Language badge */
    .fh-cell-bahasa-wrap {
        grid-column: 3;
        grid-row: 2;
        display: flex;
        justify-content: flex-end;
        align-self: start;
    }

    .fh-lang-badge,
    .fh-status-badge {
        font-size: 10px;
        padding: 2px 8px;
        gap: 3px;
    }

    .fh-lang-badge .fh-flag {
        font-size: 11px;
    }

    .fh-status-badge .fh-status-icon {
        font-size: 9px;
    }

    /* Remove the stacked labels — not needed in horizontal layout */
    .fh-cell-siswa::before,
    .fh-cell-tutor::before {
        display: none;
    }
}

/* ── Responsive: Small Mobile ──────────────────────────────────────────────── */

@media (max-width: 380px) {
    .fh-filter-btn {
        padding: 3px 8px;
        font-size: 10px;
    }

    .fh-cell-time {
        font-size: 13px;
    }

    .fh-cell-siswa {
        font-size: 12px;
    }

    .fh-cell-tutor {
        font-size: 10px;
    }

    .fh-table-row {
        padding: 6px 8px;
        grid-template-columns: 55px 1fr auto;
    }

    .fh-lang-badge,
    .fh-status-badge {
        font-size: 9px;
        padding: 1px 6px;
    }
}
