/* ============================================================
   PrizeHub Shared Table Styles (ph-tables.css)
   Used by: [my_giveaways_table] and [ph_user_entry_history]
   ============================================================ */

.ph-table-container {
    background: #1c1508;
    border: 1px solid rgba(200, 146, 42, 0.3);
    border-radius: 16px;
    overflow: hidden;
    font-family: inherit;
    width: 100%;
}

/* ---- Header ---- */
.ph-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 12px;
    flex-wrap: wrap;
    background: #1c1508;
}

.ph-table-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ph-tab-btn {
    padding: 8px 18px;
    border-radius: 30px;
    border: 1.5px solid #c8922a !important;
    background: transparent !important;
    color: #c8922a !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}

.ph-tab-btn.ph-tab-active {
    background: linear-gradient(135deg, #c8922a, #4a3e24) !important;
    color: #1c1508 !important;
    border-color: transparent !important;
}

.ph-tab-btn:hover:not(.ph-tab-active) {
    background: rgba(200, 146, 42, 0.1);
}

/* ---- Search ---- */
.ph-table-search-wrap {
    position: relative;
    min-width: 220px;
}

.ph-table-search-wrap svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #8a7a5a;
    pointer-events: none;
}

.ph-table-search {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: #2a1f08;
    border: 1.5px solid rgba(200, 146, 42, 0.4);
    border-radius: 30px;
    color: #ffffff;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    text-indent: 20px !important;
}

.ph-table-search::placeholder {
    color: #8a7a5a;
}

.ph-table-search:focus {
    border-color: #c8922a;
}

/* ---- Table ---- */
.ph-data-table {
    width: 100%;
    border-collapse: collapse;
}

.ph-data-table thead tr {
    background: #1c1508;
    border-bottom: 1px solid rgba(200, 146, 42, 0.2);
}

.ph-data-table thead th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    color: #8a7a5a;
    letter-spacing: 0.08em;
    text-align: left;
    white-space: nowrap;
}

.ph-data-table tbody tr {
    border-bottom: 1px solid rgba(200, 146, 42, 0.1);
    transition: background 0.15s;
}

.ph-data-table tbody tr:last-child {
    border-bottom: none;
}

.ph-data-table tbody tr:hover {
    background: rgba(200, 146, 42, 0.04);
}

.ph-data-table tbody td {
    padding: 16px;
    font-size: 14px;
    color: #ffffff;
    vertical-align: middle;
}

/* ---- Giveaway cell ---- */
.ph-giveaway-cell {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ph-giveaway-thumb {
    width: 72px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.ph-giveaway-thumb-placeholder {
    width: 72px;
    height: 52px;
    background: #2a1f08;
    border-radius: 8px;
    border: 1px solid rgba(200, 146, 42, 0.2);
    flex-shrink: 0;
}

.ph-giveaway-title {
    font-size: 15px;
    font-weight: 600;
    color: #c8922a;
    display: block;
    margin-bottom: 4px;
}

.ph-giveaway-desc {
    font-size: 12px;
    color: #8a7a5a;
    line-height: 1.4;
}

/* ---- Entries count ---- */
.ph-entries-count {
    font-size: 18px;
    font-weight: 700;
    color: #c8922a;
    text-align: center;
    display: block;
}

.ph-entries-pos {
    color: #c8922a;
    font-weight: 700;
}

.ph-entries-neg {
    color: #e05555;
    font-weight: 700;
}

/* ---- Status badges ---- */
.ph-status-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.ph-status-open {
    background: #2a1f08;
    color: #f0b429;
    border: 1.5px solid #c8922a;
}

.ph-status-drawn {
    background: #3f2f18;
    color: #e0e0e0;
    border: 1.5px solid #555;
}

/* ---- Draw date ---- */
.ph-draw-date-main {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    display: block;
}

.ph-draw-date-sub {
    font-size: 12px;
    color: #8a7a5a;
    display: block;
    margin-top: 2px;
}

/* ---- Action buttons ---- */
.ph-btn-view {
    background: linear-gradient(135deg, #c8922a, #4a3e24);
    color: #1c1508 !important;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
    transition: opacity 0.2s;
}

.ph-btn-view:hover {
    opacity: 0.85;
    color: #1c1508;
    text-decoration: none;
}

.ph-btn-drawn {
    background: #3f2f18;
    color: #8a7a5a;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    white-space: nowrap;
    display: inline-block;
}

/* ---- Footer ---- */
.ph-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid rgba(200, 146, 42, 0.15);
    flex-wrap: wrap;
    gap: 12px;
}

.ph-showing-text {
    font-size: 13px;
    color: #8a7a5a;
}

.ph-showing-text strong {
    color: #c8922a;
}

/* ---- Pagination ---- */
.ph-pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ph-page-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid rgba(200, 146, 42, 0.35);
    background: transparent;
    color: #c8922a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

.ph-page-btn.ph-page-active {
    background: linear-gradient(135deg, #c8922a, #4a3e24);
    color: #1c1508;
    border-color: transparent;
}

.ph-page-btn:hover:not(.ph-page-active):not([disabled]) {
    background: rgba(200, 146, 42, 0.12);
}

.ph-page-btn[disabled],
.ph-page-btn.ph-page-disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.ph-page-ellipsis {
    color: #8a7a5a;
    font-size: 14px;
    padding: 0 2px;
}

/* ---- States ---- */
.ph-table-loading {
    text-align: center;
    padding: 40px 16px;
    color: #8a7a5a;
}

.ph-table-empty {
    text-align: center;
    padding: 40px 16px;
    color: #8a7a5a;
}

/* ============================================================
   Mobile Responsive (≤ 680px)
   ============================================================ */
@media (max-width: 680px) {

    /* Header: scrollable tabs + icon search */
    .ph-table-header {
        padding: 10px 12px;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .ph-table-tabs {
        flex: 1;
        min-width: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .ph-table-tabs::-webkit-scrollbar {
        display: none;
    }

    .ph-tab-btn {
        padding: 7px 11px;
        font-size: 11px;
    }

    /* Search: icon-only toggle on mobile */
    .ph-table-search-wrap {
        min-width: unset;
        flex-shrink: 0;
        position: static;
    }

    .ph-table-search-wrap>svg {
        display: none;
    }

    .ph-table-search-wrap .ph-table-search {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid rgba(200, 146, 42, 0.4);
        background: #1a1208;
        padding: 12px 14px 12px 36px;
        z-index: 20;
        display: none;
        box-sizing: border-box;
    }

    .ph-table-search-wrap .ph-table-search.ph-search-open {
        display: block;
    }

    .ph-table-container {
        position: relative;
    }

    .ph-search-icon-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        border: 1.5px solid rgba(200, 146, 42, 0.4);
        background: #2a1f08;
        cursor: pointer;
        color: #8a7a5a;
        flex-shrink: 0;
    }

    .ph-search-icon-btn.active {
        color: #c8922a;
        border-color: #c8922a;
    }

    /* Hide desktop table header */
    .ph-data-table thead {
        display: none;
    }

    /* Hide desktop rows */
    .ph-desktop-row {
        display: none !important;
    }

    /* Mobile card rows */
    .ph-mobile-row>td {
        padding: 6px 10px;
        border: none;
    }

    .ph-mobile-row:hover {
        background: transparent !important;
    }

    .ph-mobile-card {
        background: #211b0e;
        border-radius: 12px;
        padding: 14px;
        border: 1px solid rgba(200, 146, 42, 0.15);
    }

    .ph-mc-label {
        font-size: 10px;
        color: #7a6a4a;
        letter-spacing: 0.08em;
        font-weight: 700;
        margin-bottom: 10px;
    }

    .ph-mc-top {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 0;
    }

    .ph-mc-top .ph-giveaway-thumb {
        width: 84px;
        height: 64px;
        flex-shrink: 0;
        object-fit: cover;
        border-radius: 8px;
    }

    .ph-mc-top .ph-giveaway-thumb-placeholder {
        width: 84px;
        height: 64px;
        flex-shrink: 0;
    }

    .ph-mc-top-text {
        flex: 1;
        min-width: 0;
    }

    .ph-mc-title {
        font-size: 15px;
        font-weight: 700;
        color: #c8922a;
        display: block;
        margin-bottom: 5px;
        line-height: 1.25;
    }

    .ph-mc-desc {
        font-size: 12px;
        color: #8a7a5a;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .ph-mc-stats {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 6px;
        padding: 12px 0;
        margin-top: 12px;
        border-top: 1px solid rgba(200, 146, 42, 0.1);
        margin-bottom: 12px;
    }

    .ph-mc-stat {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .ph-mc-stat-label {
        font-size: 9px;
        color: #7a6a4a;
        letter-spacing: 0.06em;
        font-weight: 700;
        text-transform: uppercase;
    }

    .ph-mc-stat-value {
        font-size: 17px;
        font-weight: 700;
        color: #c8922a;
    }

    .ph-mc-date-main {
        font-size: 13px;
        font-weight: 600;
        color: #ffffff;
        display: block;
        line-height: 1.2;
    }

    .ph-mc-date-sub {
        font-size: 11px;
        color: #8a7a5a;
        display: block;
        margin-top: 2px;
    }

    .ph-mc-action .ph-btn-view,
    .ph-mc-action .ph-btn-drawn {
        display: block;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        border-radius: 10px;
        padding: 13px;
        font-size: 14px;
    }

    /* Footer */
    .ph-table-footer {
        padding: 12px 14px;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .ph-pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Desktop: hide mobile elements */
@media (min-width: 681px) {
    .ph-mobile-row {
        display: none !important;
    }

    .ph-search-icon-btn {
        display: none !important;
    }
}