/**
 * WooCommerce Category Budget & Wallet - Frontend Styles
 */

/* Cart and Checkout Banner */
.wc-cbw-cart-banner-wrapper {
    transition: opacity 0.25s ease;
    display: block;
}

.wc-cbw-cart-banner-wrapper.wc-cbw-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Disabled Checkout Button when limit exceeded */
.wc-cbw-disabled-btn {
    opacity: 0.5 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    filter: grayscale(80%);
}

.wc-cbw-cart-banner {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wc-cbw-cart-banner .wc-cbw-banner-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: #1e293b;
    margin-bottom: 12px;
}

.wc-cbw-cart-banner .wc-cbw-banner-header .dashicons {
    color: #2563eb;
    font-size: 20px;
}

.wc-cbw-banner-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.wc-cbw-metric {
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.wc-cbw-metric .label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}

.wc-cbw-metric .value {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.wc-cbw-metric .value.ok {
    color: #16a34a;
}

.wc-cbw-metric .value.warning {
    color: #dc2626;
}

.wc-cbw-metric .value.unlimited {
    color: #2563eb;
}

/* Detailed Category Breakdown Table */
.wc-cbw-cart-cat-table-wrap {
    width: 100%;
    margin-top: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.wc-cbw-cat-table-title {
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.wc-cbw-cart-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 0;
}

.wc-cbw-cart-breakdown-table th,
.wc-cbw-cart-breakdown-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.wc-cbw-cart-breakdown-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wc-cbw-cart-breakdown-table tr:last-child td {
    border-bottom: none;
}

.wc-cbw-cart-breakdown-table tr.in-cart {
    background-color: #f8fafc;
}

.wc-cbw-cart-breakdown-table tr.limit-exceeded {
    background-color: #fef2f2 !important;
}

.wc-cbw-cart-breakdown-table tr.limit-exceeded td {
    border-bottom-color: #fee2e2;
}

.wc-cbw-in-cart-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 3px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.wc-cbw-badge-positive {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    background: #dcfce7;
    color: #15803d;
    font-weight: 600;
}

.wc-cbw-badge-negative {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    background: #fee2e2;
    color: #b91c1c;
    font-weight: 700;
}

.wc-cbw-badge-neutral {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
    font-weight: 500;
}

/* My Account Wallet Dashboard */
.wc-cbw-account-dashboard {
    margin-top: 10px;
}

.wc-cbw-welcome-header h2 {
    margin-bottom: 6px;
    font-size: 24px;
    color: #0f172a;
}

.wc-cbw-welcome-header .subtitle {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 24px;
}

/* KPI Cards */
.wc-cbw-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.wc-cbw-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.15s ease;
}

.wc-cbw-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.wc-cbw-kpi-card .kpi-icon {
    font-size: 28px;
    background: #f1f5f9;
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wc-cbw-kpi-card .kpi-info {
    display: flex;
    flex-direction: column;
}

.wc-cbw-kpi-card .kpi-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    font-weight: 600;
}

.wc-cbw-kpi-card .kpi-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 2px;
}

.wc-cbw-kpi-card.total-remaining .kpi-value.highlight {
    color: #16a34a;
}

/* Progress Container */
.wc-cbw-progress-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 30px;
}

.wc-cbw-progress-container .progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #334155;
    margin-bottom: 10px;
}

.wc-cbw-progress-bar {
    background: #e2e8f0;
    border-radius: 9999px;
    height: 12px;
    overflow: hidden;
}

.wc-cbw-progress-bar .progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease;
}

.progress-fill.success {
    background: #16a34a;
}

.progress-fill.warning {
    background: #eab308;
}

.progress-fill.danger {
    background: #dc2626;
}

/* Categories Table */
.wc-cbw-categories-section h3 {
    font-size: 18px;
    color: #0f172a;
    margin-bottom: 14px;
}

.wc-cbw-table-responsive {
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.wc-cbw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.wc-cbw-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.wc-cbw-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.wc-cbw-table tr:last-child td {
    border-bottom: none;
}

.wc-cbw-table tr:hover td {
    background: #f8fafc;
}

.cat-rem .rem-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.rem-badge.badge-available {
    background: #dcfce7;
    color: #15803d;
}

.rem-badge.badge-exhausted {
    background: #fee2e2;
    color: #b91c1c;
}

.wc-cbw-mini-progress {
    background: #e2e8f0;
    border-radius: 9999px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 4px;
}

.wc-cbw-mini-progress .mini-bar {
    height: 100%;
    border-radius: 9999px;
}

.wc-cbw-mini-progress .mini-bar.success { background: #16a34a; }
.wc-cbw-mini-progress .mini-bar.warning { background: #eab308; }
.wc-cbw-mini-progress .mini-bar.danger  { background: #dc2626; }

.mini-pct {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}

/* Info Note */
.wc-cbw-info-note {
    margin-top: 24px;
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 12px 16px;
    border-radius: 6px;
}

.wc-cbw-info-note p {
    margin: 0;
    font-size: 13px;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wc-cbw-info-note .dashicons {
    font-size: 18px;
}

/* Single Product Budget Widget */
.wc-cbw-product-budget-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 18px;
    margin-top: 15px;
    margin-bottom: 22px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.wc-cbw-product-budget-box.status-sufficient {
    border-left: 4px solid #16a34a;
}

.wc-cbw-product-budget-box.status-insufficient {
    border-left: 4px solid #dc2626;
    background: #fffcfc;
}

.wc-cbw-product-budget-box.status-zero_limit {
    border-left: 4px solid #94a3b8;
    background: #f8fafc;
}

.wc-cbw-product-budget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 15px;
    color: #1e293b;
}

.wc-cbw-product-budget-header .dashicons {
    color: #0284c7;
    font-size: 18px;
}

.wc-cbw-product-cat-pill {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
}

.wc-cbw-feasibility-alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wc-cbw-product-budget-box.status-sufficient .wc-cbw-feasibility-alert {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.wc-cbw-product-budget-box.status-insufficient .wc-cbw-feasibility-alert {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.wc-cbw-product-budget-box.status-zero_limit .wc-cbw-feasibility-alert {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.wc-cbw-product-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.wc-cbw-product-metric {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 10px 12px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
}

.wc-cbw-product-metric .metric-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.2;
}

.wc-cbw-product-metric .metric-value {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.wc-cbw-product-metric .metric-value.ok {
    color: #16a34a;
}

.wc-cbw-product-metric .metric-value.warning {
    color: #dc2626;
}

.wc-cbw-product-metric .metric-value.unlimited {
    color: #0284c7;
}

/* Accordion details in product */
.wc-cbw-product-table-details {
    margin-top: 8px;
    border-top: 1px dashed #e2e8f0;
    padding-top: 10px;
}

.wc-cbw-product-table-summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #0284c7;
    outline: none;
    user-select: none;
}

.wc-cbw-product-table-summary:hover {
    color: #0369a1;
    text-decoration: underline;
}

.is-current-product-cat {
    background-color: #f0f9ff !important;
    font-weight: 600;
}

.wc-cbw-badge-current-product {
    display: inline-block;
    background: #0284c7;
    color: #ffffff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}
