/**
 * Tickets page styles
 * Prefix: tkt_
 *
 * Two main pieces:
 *   1. Ticket-shaped card (.tkt_card and the bigger .tkt_main) — rounded
 *      corners with two semicircular notches on the side edges and a
 *      dashed divider between the two halves. The notch effect is done
 *      by overlaying small circles painted with the page background, so
 *      it works in both light and dark modes without a mask trick.
 *   2. Rotating-QR detail with a thin progress ring around the code.
 */

/* ============================================
   INDEX (LIST) PAGE
   ============================================ */
.tkt_main_cntr {
    min-width: 200px;
    max-width: 720px;
    width: 100%;
}

.tkt_index { width: 100%; }

.tkt_idx_header {
    padding: 4px 0 12px;
}
.tkt_idx_title_row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.tkt_idx_title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.tkt_idx_browse_btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 22px;
    background: var(--elevated-highlight);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s, background 0.2s;
}
.tkt_idx_browse_btn:hover { opacity: 0.85; }
.tkt_idx_browse_btn i { font-size: 14px; }

.tkt_idx_tabs {
    display: flex;
    border-bottom: 1.5px solid var(--border-color);
    padding: 0 4px;
    margin-top: 12px;
}
.tkt_idx_tab {
    flex: 1;
    background: none;
    border: none;
    padding: 14px 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}
.tkt_idx_tab:hover { color: var(--text-primary); }
.tkt_idx_tab.active {
    color: var(--text-primary);
    font-weight: 700;
}
.tkt_idx_tab.active::after {
    content: '';
    position: absolute;
    bottom: -1.5px;
    left: 0; right: 0;
    height: 3px;
    border-radius: 2px 2px 0 0;
    background: var(--button-blue);
}
.tkt_idx_tab_content { display: none; }
.tkt_idx_tab_content.active { display: block; }

/* ============================================
   LIST + SECTIONS
   ============================================ */
.tkt_list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 14px;
}
.tkt_section { }
.tkt_section_head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    background: var(--elevated-surface);
    padding: 8px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
}
.tkt_section_label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.tkt_section_count {
    font-size: 13px;
}
.tkt_section_body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   TICKET CARD (list)
   ============================================
   Anatomy:
     [ banner background + dark gradient overlay      ]
     [ status pill + globe                            ]
     [ event title                                    ]
     [ time row                                       ]
     ──── notch ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ notch ────
     [ org avatar + name             [ ACTIVE pill ] ]
*/
.tkt_card {
    --tkt-bg: var(--container);
    --tkt-notch-bg: var(--page-color);
    --tkt-notch-size: 24px;
    --tkt-radius: 16px;

    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--tkt-bg);
    border-radius: var(--tkt-radius);
    overflow: hidden;
    border: 1px solid var(--dark-border);
    box-shadow: var(--light-shadow) 0px 2px 14px;
    position: relative;
    transition: transform 0.15s, box-shadow 0.15s;
}
.tkt_card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--shadow-color);
}

/* Top half: banner image with darkening overlay so the white text reads */
.tkt_card_top {
    position: relative;
    background-color: var(--surface-variant);
    background-size: cover;
    background-position: center;
    color: #fff;
    padding: 14px 16px 16px;
    min-height: 140px;
}
.tkt_card_top_overlay {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tkt_card_top::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 0.55) 100%
    );
    z-index: 0;
}

.tkt_card_top_row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tkt_card_loc_ico {
    color: #fff;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.35);
    padding: 6px;
    border-radius: 50%;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Status pill (top-left of card) */
.tkt_status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    text-transform: capitalize;
}
.tkt_status_upcoming { background: var(--red); }
.tkt_status_past     { background: rgba(0, 0, 0, 0.55); }
.tkt_status_cancelled{ background: var(--text-tertiary); }

.tkt_card_title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    margin: 4px 0 0;
    /* clamp at 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tkt_card_time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.35);
    padding: 5px 10px;
    border-radius: 8px;
    width: fit-content;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.tkt_card_time i { font-size: 13px; }

/* ============================================
   THE NOTCHES + DASHED DIVIDER
   ============================================
   Visual: two semicircles cut out of the side edges with a dashed line
   between. We achieve "cut out" by overlaying circles painted with the
   *page* background color so they blend into whatever surface sits behind
   the card. This gives the iconic ticket shape without using SVG masks.
*/
.tkt_card_split {
    position: relative;
    height: 1px;
    margin: 0 18px;
    background: transparent;
}
.tkt_dashes {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    border-top: 1.5px dashed var(--border-color);
}
.tkt_notch {
    position: absolute;
    top: 50%;
    width: var(--tkt-notch-size);
    height: var(--tkt-notch-size);
    border-radius: 50%;
    background: var(--tkt-notch-bg);
    transform: translateY(-50%);
}
.tkt_notch_left  { left:  calc(-18px - var(--tkt-notch-size) / 2); }
.tkt_notch_right { right: calc(-18px - var(--tkt-notch-size) / 2); }

/* When the card sits inside the .ctnr / page area, the notch background
   should match — we expose --tkt-notch-bg as a custom property so callers
   can override (e.g. ticket nested inside an --elevated-surface block). */

/* Bottom half */
.tkt_card_bot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}
.tkt_card_org {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.tkt_card_org_avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--elevated);
    flex-shrink: 0;
}
.tkt_card_org_avatar img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.tkt_card_org_avatar .prof_img_fallback {
    font-size: 14px;
}
.tkt_card_org_name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status badge (active / used / void) */
.tkt_badge {
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}
.tkt_badge_active {
    background: var(--elevated-highlight);
    color: var(--text-secondary);
}
.tkt_badge_used {
    background: var(--elevated-surface);
    color: var(--text-tertiary);
}
.tkt_badge_void {
    background: var(--error-muted);
    color: var(--text-error);
}

/* ============================================
   TICKET DETAIL PAGE
   ============================================ */
.tkt_detail {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 6px;
}
.tkt_back_link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    width: fit-content;
}
.tkt_back_link:hover { text-decoration: underline; }
.tkt_back_link i { font-size: 14px; }

.tkt_main {
    --tkt-bg: var(--container);
    --tkt-notch-bg: var(--page-color);
    --tkt-radius: 18px;

    background: var(--tkt-bg);
    border-radius: var(--tkt-radius);
    padding: 22px 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tkt_main_head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.tkt_main_org {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}
.tkt_main_org_avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--elevated);
    flex-shrink: 0;
}
.tkt_main_org_avatar img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.tkt_main_org_meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}
.tkt_main_org_label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.tkt_main_org_name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tkt_main_title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.25;
}

/* ============================================
   QR SECTION
   ============================================ */
.tkt_qr_section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 4px 0 8px;
}

.tkt_qr_frame {
    --qr-size: 220px;
    position: relative;
    width: var(--qr-size);
    height: var(--qr-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ring shows time-until-rotate */
.tkt_qr_ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* start at 12 o'clock */
}
.tkt_qr_ring_track,
.tkt_qr_ring_progress {
    fill: none;
    stroke-width: 2;
}
.tkt_qr_ring_track {
    stroke: var(--border-color);
}
.tkt_qr_ring_progress {
    stroke: var(--blue);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

.tkt_qr_box {
    position: relative;
    width: calc(var(--qr-size) - 24px);
    height: calc(var(--qr-size) - 24px);
    background: #fff; /* QR is always rendered on white for max scan reliability */
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 0 0 6px var(--container);
}
.tkt_qr_canvas {
    width: 100%;
    height: 100%;
    --qr-bg: #ffffff;
    --qr-fg: #0f0f0f;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tkt_qr_canvas .qr_svg {
    width: 100%;
    height: 100%;
    display: block;
}
.tkt_qr_loading {
    font-size: 13px;
}
.qr_error {
    font-size: 13px;
    color: var(--text-error);
    padding: 12px;
    text-align: center;
}

.tkt_qr_hint {
    font-size: 13px;
    text-align: center;
    max-width: 320px;
    margin: 0;
    line-height: 1.5;
}
.tkt_qr_hint strong {
    color: var(--text-primary);
}

/* ============================================
   DETAILS GRID
   ============================================ */
.tkt_card_split_lg {
    margin: 4px 22px 8px;
}

.tkt_details {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.tkt_detail_grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}
.tkt_detail_block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.tkt_detail_block_full {
    grid-column: 1 / -1;
}
.tkt_detail_label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.tkt_detail_value {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}
.tkt_detail_loc_ico {
    font-size: 13px;
    margin-right: 4px;
    color: var(--text-secondary);
}
.tkt_mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.02em;
}

/* ============================================
   FOOTER ACTIONS
   ============================================ */
.tkt_main_actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}
.tkt_action_btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.15s, color 0.15s;
}
.tkt_action_btn:hover {
    background: var(--elevated-highlight);
    color: var(--text-primary);
}
.tkt_action_btn i { font-size: 18px; }

/* ============================================
   SIDE PANE
   ============================================ */
.tkt_stats_wid { }
.tkt_stats_grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}
.tkt_stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: var(--elevated-surface);
    border-radius: 10px;
    gap: 4px;
}
.tkt_stat_num {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}
.tkt_stat_label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

/* Linked-event card on the ticket detail side pane */
.tkt_event_link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    padding: 0;
    background: var(--container);
    border-radius: 12px;
    transition: transform 0.15s, box-shadow 0.15s;
    border-bottom: none;
}
.tkt_event_link:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--shadow-color);
}
.tkt_event_link_banner {
    width: 100%;
    aspect-ratio: 16 / 8;
    background-size: cover;
    background-position: center;
    background-color: var(--elevated);
}
.tkt_event_link_meta {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tkt_event_link_label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.tkt_event_link_title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
}
.tkt_event_link_sub {
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tkt_event_link_sub i { font-size: 13px; }
.tkt_event_link_cta {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Tips list */
.tkt_tips {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 12px;
}
.tkt_tip {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.tkt_tip_ico {
    font-size: 18px;
    color: var(--blue);
    margin-top: 2px;
    flex-shrink: 0;
}
.tkt_tip_title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.tkt_tip_sub {
    display: block;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 2px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media screen and (max-width: 700px) {
    .tkt_main { padding: 18px 18px 16px; }
    .tkt_main_title { font-size: 20px; }
    .tkt_qr_frame { --qr-size: 200px; }
    .tkt_detail_grid { grid-template-columns: 1fr; }
    .tkt_card_title { font-size: 19px; }
    .tkt_card_top { min-height: 120px; }
}
