/* ── TTP Course List — course-list.css ──────────────────────────────────────
   Self-contained styles. Uses a ttp-cl- prefix to avoid collisions.
   Designed to look clean and professional on any WordPress theme.
──────────────────────────────────────────────────────────────────────────── */

/* ── Design tokens ─────────────────────────────────────────────────────────── */
.ttp-cl-wrap {
    --cl-primary:      #2563a8;
    --cl-primary-dark: #1a4a80;
    --cl-accent:       #f59e0b;
    --cl-green:        #16a34a;
    --cl-surface:      #ffffff;
    --cl-bg:           #f8f9fc;
    --cl-border:       #e2e8f0;
    --cl-text:         #1e293b;
    --cl-muted:        #64748b;
    --cl-radius:       10px;
    --cl-shadow:       0 2px 12px rgba(37,99,168,0.08);
    --cl-shadow-lg:    0 8px 32px rgba(37,99,168,0.18);
    --cl-font:         -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    font-family:       var(--cl-font);
    color:             var(--cl-text);
    max-width:         1200px;
    margin:            0 auto;
    padding:           0 1rem 3rem;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.ttp-cl-header    { margin-bottom: 1.5rem; }
.ttp-cl-title     { font-size: 1.6rem; font-weight: 700; margin: 0 0 0.35rem; color: var(--cl-text); }
.ttp-cl-subtitle  { font-size: 0.95rem; color: var(--cl-muted); margin: 0; }

/* ── Controls row ──────────────────────────────────────────────────────────── */
.ttp-cl-controls {
    display:        flex;
    flex-wrap:      wrap;
    gap:            0.75rem;
    margin-bottom:  1rem;
    align-items:    center;
}
.ttp-cl-search-wrap { flex: 1 1 300px; }
.ttp-cl-filter-wrap {
    display:     flex;
    flex-wrap:   wrap;
    gap:         0.5rem;
    align-items: center;
}

#ttp-search,
.ttp-cl-filter-wrap select {
    padding:       0.55rem 0.85rem;
    border:        1.5px solid var(--cl-border);
    border-radius: var(--cl-radius);
    font-size:     0.9rem;
    font-family:   var(--cl-font);
    color:         var(--cl-text);
    background:    var(--cl-surface);
    outline:       none;
    width:         100%;
    transition:    border-color 0.2s;
}
#ttp-search:focus,
.ttp-cl-filter-wrap select:focus { border-color: var(--cl-primary); }
.ttp-cl-filter-wrap select       { min-width: 160px; width: auto; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.ttp-btn {
    display:         inline-flex;
    align-items:     center;
    gap:             0.35rem;
    font-family:     var(--cl-font);
    font-weight:     600;
    font-size:       0.88rem;
    padding:         0.55rem 1.1rem;
    border-radius:   var(--cl-radius);
    border:          2px solid transparent;
    cursor:          pointer;
    text-decoration: none;
    transition:      all 0.2s;
    white-space:     nowrap;
    line-height:     1.2;
}
.ttp-btn-primary {
    background:   var(--cl-primary);
    color:        #fff;
    border-color: var(--cl-primary);
}
.ttp-btn-primary:hover {
    background:   var(--cl-primary-dark);
    border-color: var(--cl-primary-dark);
    color:        #fff;
    text-decoration: none;
}
.ttp-btn-outline {
    background:   transparent;
    color:        var(--cl-primary);
    border-color: var(--cl-primary);
}
.ttp-btn-outline:hover {
    background: var(--cl-primary);
    color:      #fff;
    text-decoration: none;
}
.ttp-btn-ghost {
    background:   transparent;
    color:        var(--cl-muted);
    border-color: var(--cl-border);
}
.ttp-btn-ghost:hover { color: var(--cl-text); border-color: var(--cl-text); }

/* ── Info bar ──────────────────────────────────────────────────────────────── */
.ttp-cl-info-bar {
    display:         flex;
    align-items:     center;
    gap:             1rem;
    font-size:       0.85rem;
    color:           var(--cl-muted);
    margin-bottom:   0.75rem;
    min-height:      24px;
}
.ttp-spinner { font-style: italic; }

/* ── Table ─────────────────────────────────────────────────────────────────── */
.ttp-cl-table-wrap {
    overflow-x:    auto;
    border-radius: var(--cl-radius);
    border:        1px solid var(--cl-border);
    box-shadow:    var(--cl-shadow);
    background:    var(--cl-surface);
}
.ttp-cl-table {
    width:           100%;
    border-collapse: collapse;
    font-size:       0.88rem;
}
.ttp-cl-table thead tr {
    background:    var(--cl-bg);
    border-bottom: 2px solid var(--cl-border);
}
.ttp-cl-table th {
    padding:        0.75rem 1rem;
    text-align:     left;
    font-weight:    700;
    font-size:      0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color:          var(--cl-muted);
    white-space:    nowrap;
}
.ttp-cl-table td {
    padding:       0.7rem 1rem;
    border-bottom: 1px solid var(--cl-border);
    vertical-align: top;
    line-height:   1.45;
}
.ttp-cl-table tbody tr:last-child td { border-bottom: none; }
.ttp-cl-table tbody tr:hover { background: #e8f0fe !important; }
.ttp-cl-table tbody tr:hover td { background: #e8f0fe !important; color: var(--cl-text) !important; }

/* Column widths */
.col-title    { min-width: 260px; }
.col-provider { min-width: 160px; }
.col-country  { min-width: 100px; }
.col-date     { min-width: 100px; white-space: nowrap; }
.col-price    { min-width: 90px;  white-space: nowrap; }
.col-topics   { min-width: 180px; }

/* Course title link */
.ttp-course-title-btn {
    background:   none;
    border:       none;
    padding:      0;
    font-family:  var(--cl-font);
    font-size:    0.88rem;
    font-weight:  600;
    color:        var(--cl-primary);
    cursor:       pointer;
    text-align:   left;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition:   text-decoration-color 0.2s, color 0.2s;
    line-height:  1.4;
}
.ttp-course-title-btn:hover {
    color: var(--cl-primary-dark) !important;
    text-decoration-color: var(--cl-primary-dark) !important;
    background: transparent !important;
}

/* Topic pills inside table */
.ttp-topic-pill {
    display:        inline-block;
    background:     #eff6ff;
    color:          #1e40af;
    font-size:      0.72rem;
    font-weight:    600;
    padding:        0.15rem 0.5rem;
    border-radius:  50px;
    margin:         2px 2px 2px 0;
    white-space:    nowrap;
}

/* Loading / empty rows */
.ttp-loading-row td,
.ttp-empty-row td {
    text-align:  center;
    padding:     2.5rem 1rem;
    color:       var(--cl-muted);
    font-style:  italic;
}

/* ── Pagination ────────────────────────────────────────────────────────────── */
.ttp-cl-pagination {
    display:         flex;
    justify-content: center;
    align-items:     center;
    gap:             0.35rem;
    padding:         1.5rem 0 0.5rem;
    flex-wrap:       wrap;
}
.ttp-page-btn {
    min-width:    36px;
    height:       36px;
    padding:      0 0.6rem;
    border:       1.5px solid var(--cl-border);
    border-radius: var(--cl-radius);
    background:   var(--cl-surface);
    color:        var(--cl-text);
    font-family:  var(--cl-font);
    font-size:    0.85rem;
    font-weight:  600;
    cursor:       pointer;
    transition:   all 0.18s;
}
.ttp-page-btn:hover            { background: var(--cl-primary); color: #fff; border-color: var(--cl-primary); }
.ttp-page-btn.active           { background: var(--cl-primary); color: #fff; border-color: var(--cl-primary); }
.ttp-page-btn:disabled         { opacity: 0.4; cursor: not-allowed; }
.ttp-page-ellipsis             { padding: 0 0.25rem; color: var(--cl-muted); font-size: 0.9rem; line-height: 36px; }

/* ── Attribution ───────────────────────────────────────────────────────────── */
.ttp-cl-attribution {
    font-size:  0.8rem;
    color:      var(--cl-muted);
    text-align: center;
    margin-top: 1rem;
}
.ttp-cl-attribution a { color: var(--cl-primary); }

/* ══════════════════════════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════════════════════════ */
.ttp-modal-overlay {
    position:        fixed;
    inset:           0;
    background:      rgba(15, 23, 42, 0.6);
    z-index:         99999;
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         1rem;
    backdrop-filter: blur(3px);
}
.ttp-modal-overlay[hidden] { display: none; }

.ttp-modal {
    background:    var(--cl-surface);
    border-radius: 16px;
    box-shadow:    var(--cl-shadow-lg);
    width:         100%;
    max-width:     760px;
    max-height:    90vh;
    display:       flex;
    flex-direction: column;
    overflow:      hidden;
    font-family:   var(--cl-font);
    animation:     ttpModalIn 0.22s ease;
}

@keyframes ttpModalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* Modal header */
.ttp-modal-header {
    display:         flex;
    align-items:     flex-start;
    justify-content: space-between;
    gap:             1rem;
    padding:         1.5rem 1.75rem 1.25rem;
    border-bottom:   1px solid var(--cl-border);
    background:      linear-gradient(135deg, var(--cl-primary) 0%, #1a4a80 100%);
}
.ttp-modal-title {
    font-size:   1.1rem;
    font-weight: 700;
    color:       #fff;
    margin:      0;
    line-height: 1.35;
    flex:        1;
}
.ttp-modal-close {
    background:  rgba(255,255,255,0.15);
    border:      none;
    border-radius: 50%;
    width:       32px;
    height:      32px;
    color:       #fff;
    font-size:   1.2rem;
    cursor:      pointer;
    flex-shrink: 0;
    line-height: 1;
    transition:  background 0.18s;
}
.ttp-modal-close:hover { background: rgba(255,255,255,0.3); }

/* Modal body */
.ttp-modal-body {
    flex:       1;
    overflow-y: auto;
    padding:    1.5rem 1.75rem;
}

/* Quick-facts pills row */
.ttp-modal-pills {
    display:       flex;
    flex-wrap:     wrap;
    gap:           0.5rem;
    margin-bottom: 1.25rem;
}
.ttp-modal-pill {
    display:        inline-flex;
    align-items:    center;
    gap:            0.3rem;
    background:     #eff6ff;
    color:          #1e40af;
    border:         1px solid #bfdbfe;
    font-size:      0.8rem;
    font-weight:    600;
    padding:        0.3rem 0.75rem;
    border-radius:  50px;
}
.ttp-modal-pill.green  { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.ttp-modal-pill.amber  { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.ttp-modal-pill.purple { background: #faf5ff; color: #6b21a8; border-color: #e9d5ff; }

/* Modal section */
.ttp-modal-section       { margin-bottom: 1.25rem; }
.ttp-modal-section h3    { font-size: 0.85rem; font-weight: 700; text-transform: uppercase;
                            letter-spacing: 0.06em; color: var(--cl-muted); margin: 0 0 0.5rem; }
.ttp-modal-section p     { font-size: 0.92rem; color: var(--cl-text); line-height: 1.65; margin: 0; }

/* Modal detail grid */
.ttp-modal-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap:                   0.75rem;
    margin-top:            0.75rem;
}
.ttp-modal-grid-item {
    background:    var(--cl-bg);
    border:        1px solid var(--cl-border);
    border-radius: var(--cl-radius);
    padding:       0.75rem;
}
.ttp-modal-grid-label {
    font-size:      0.72rem;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color:          var(--cl-muted);
    margin-bottom:  0.25rem;
}
.ttp-modal-grid-value {
    font-size:   0.88rem;
    color:       var(--cl-text);
    line-height: 1.4;
    word-break:  break-word;
}

/* Modal footer */
.ttp-modal-footer {
    display:         flex;
    justify-content: flex-end;
    align-items:     center;
    gap:             0.75rem;
    padding:         1rem 1.75rem;
    border-top:      1px solid var(--cl-border);
    background:      var(--cl-bg);
    flex-wrap:       wrap;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .ttp-cl-controls     { flex-direction: column; }
    .ttp-cl-filter-wrap  { width: 100%; }
    .ttp-cl-filter-wrap select { flex: 1; min-width: 0; }
    .ttp-modal-header,
    .ttp-modal-body,
    .ttp-modal-footer    { padding-left: 1.1rem; padding-right: 1.1rem; }
    .ttp-modal-grid      { grid-template-columns: 1fr 1fr; }
    .ttp-modal-footer    { justify-content: center; }
    .col-topics,
    .col-provider        { display: none; }
}
