/**
 * WCP Guarantee Account — Styling
 *
 * Issue #6481: Guarantees tab in WooCommerce My Account
 * Extends ifs-account.css badge system with guarantee-specific additions.
 *
 * @author Olivier RAVEAU - Oliv.Ai
 * @date 2026-03-30
 */

/* ── Section Layout ── */

.wcp-guarantee-section {
    padding: 10px 0;
}

.wcp-guarantee-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #003366;
    margin-bottom: 5px;
}

.wcp-guarantee-section h3 i {
    color: #003366;
}

/* ── Intro Messages ── */

.wcp-guarantee-intro,
.wcp-guarantee-completed-intro {
    background: #f0f4f8;
    border-left: 4px solid #003366;
    padding: 12px 18px;
    margin-bottom: 18px;
    border-radius: 0 8px 8px 0;
}

.wcp-guarantee-intro p,
.wcp-guarantee-completed-intro p {
    margin: 0;
    font-size: 13px;
    color: #555;
}

.wcp-orders-intro {
    background: #f0f4f8;
    border-left: 4px solid #003366;
    padding: 12px 18px;
    margin-bottom: 18px;
    border-radius: 0 8px 8px 0;
}

.wcp-orders-intro p {
    margin: 0;
    font-size: 13px;
    color: #555;
}

.wcp-orders-intro i {
    color: #003366;
}

/* ── DataTable Compact Overrides ── */

#wcp-guarantees-wrap .dataTables_wrapper {
    font-size: 12px;
}

#wcp-guarantees-wrap .dataTables_length {
    font-size: 12px;
    margin-bottom: 8px;
}

#wcp-guarantees-wrap .dataTables_length select {
    font-size: 12px;
    padding: 2px 6px;
    height: 28px;
}

#wcp-guarantees-wrap .dataTables_filter {
    font-size: 12px;
    margin-bottom: 8px;
}

#wcp-guarantees-wrap .dataTables_filter input {
    font-size: 12px;
    padding: 4px 8px;
    height: 28px;
    width: 150px;
}

#wcp-guarantees-wrap .dataTables_info {
    font-size: 11px;
    color: #888;
    padding-top: 6px;
}

/* Pagination — compact, no double borders */
#wcp-guarantees-wrap .dataTables_paginate {
    font-size: 12px;
    padding-top: 6px;
    display: inline-flex;
}

#wcp-guarantees-wrap .dataTables_paginate .paginate_button,
#wcp-guarantees-wrap .dataTables_paginate .paginate_button.previous,
#wcp-guarantees-wrap .dataTables_paginate .paginate_button.next {
    font-size: 12px !important;
    padding: 3px 10px !important;
    border: 1px solid #dee2e6 !important;
    border-right-width: 0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    color: #333 !important;
    display: inline-block;
    box-sizing: border-box;
}

#wcp-guarantees-wrap .dataTables_paginate .paginate_button:last-child,
#wcp-guarantees-wrap .dataTables_paginate .paginate_button.next {
    border-right-width: 1px !important;
    border-radius: 0 4px 4px 0 !important;
}

#wcp-guarantees-wrap .dataTables_paginate .paginate_button:first-child,
#wcp-guarantees-wrap .dataTables_paginate .paginate_button.previous {
    border-radius: 4px 0 0 4px !important;
}

#wcp-guarantees-wrap .dataTables_paginate .paginate_button.current,
#wcp-guarantees-wrap .dataTables_paginate .paginate_button.current:hover {
    background: #003366 !important;
    color: #fff !important;
    border-color: #003366 !important;
    border-right-width: 1px !important;
}

#wcp-guarantees-wrap .dataTables_paginate .paginate_button.disabled,
#wcp-guarantees-wrap .dataTables_paginate .paginate_button.disabled:hover {
    color: #ccc !important;
    background: #f9f9f9 !important;
    cursor: default;
}

/* ── DataTable Styling ── */

.wcp-guarantee-table {
    font-size: 13px;
}

.wcp-guarantee-table thead th {
    background: #003366;
    color: #fff;
    font-size: 11px;
    padding: 6px 8px;
    white-space: nowrap;
}

.wcp-guarantee-table tbody td {
    padding: 6px 8px;
    vertical-align: middle;
    white-space: nowrap;
}

.wcp-guarantee-table tbody tr:hover {
    background: #f0f4f8;
}

/* ── Date Badges ── */

.wcp-date-badge {
    display: inline-block;
    background: #f0f2f5;
    color: #555;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    font-family: monospace;
}

/* ── Status Badges (extends ifs-account.css) ── */

.wcp-badge--guaranteed {
    background: #cce5ff;
    color: #004085;
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.wcp-badge--count {
    background: #e2e3e5;
    color: #383d41;
    display: inline-block;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    margin-left: 4px;
}

/* ── Role Badges ── */

.wcp-role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.wcp-role-badge--own {
    background: #e2e3e5;
    color: #383d41;
}

.wcp-role-badge--invited-by-me {
    background: #d4edda;
    color: #155724;
}

.wcp-role-badge--invited-to-me {
    background: #cce5ff;
    color: #004085;
}

/* ── Action Buttons ── */

.wcp-guarantee-actions {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    align-items: center;
}

.wcp-btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    gap: 4px;
}

.wcp-btn-sm:hover {
    background: #f0f0f0;
    border-color: #999;
}

.wcp-btn-sm--info {
    border-color: #17a2b8;
    color: #17a2b8;
}

.wcp-btn-sm--info:hover {
    background: #17a2b8;
    color: #fff;
}

.wcp-btn-sm--success {
    border-color: #28a745;
    color: #28a745;
    text-decoration: none;
}

.wcp-btn-sm--success:hover {
    background: #28a745;
    color: #fff;
    text-decoration: none;
}

.wcp-btn-sm--danger {
    border-color: #dc3545;
    color: #dc3545;
}

.wcp-btn-sm--danger:hover {
    background: #dc3545;
    color: #fff;
}

/* ── View Modal Table Fix ── */

.swal2-popup .table th {
    white-space: nowrap;
    min-width: 80px;
    font-size: 12px;
}

.swal2-popup .table td {
    font-size: 12px;
    word-break: break-word;
}

.swal2-popup .table code {
    font-size: 10px;
    word-break: break-all;
}

/* ── Sidebar Count Badges (Issue #6484) ── */

.wcp-count-badge {
    display: inline-block;
    background: #003366;
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
    min-width: 18px;
    text-align: center;
    line-height: 16px;
    vertical-align: middle;
}

.woocommerce-MyAccount-navigation .is-active .wcp-count-badge {
    background: #fff;
    color: #003366;
}

.wcp-count-badge--alert {
    background: #dc3545 !important;
    color: #fff !important;
}

.woocommerce-MyAccount-navigation .is-active .wcp-count-badge--alert {
    background: #dc3545 !important;
    color: #fff !important;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .wcp-guarantee-actions {
        flex-wrap: wrap;
    }

    .wcp-guarantee-table {
        font-size: 12px;
    }

    .wcp-guarantee-table tbody td {
        white-space: normal;
    }

    .wcp-btn-sm {
        padding: 3px 6px;
        font-size: 11px;
    }
}
