/**
 * ComicCoin Rewards Widget - Consolidated Styles
 * Used by the Gutenberg block frontend rendering.
 * Adapted from checkout.css and cart-preview.css.
 */

/* ===== Container ===== */
.comiccoin-rewards-widget {
    background: #ffffff;
    border: 3px solid #667eea;
    border-radius: 8px;
    padding: 20px 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

/* ===== Header ===== */
.comiccoin-widget-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 15px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.comiccoin-widget-header .comiccoin-icon {
    font-size: 24px;
}

.comiccoin-widget-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

/* ===== Balance Section ===== */
.comiccoin-widget-balance {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.comiccoin-widget-balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.comiccoin-widget-balance-row:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

.comiccoin-widget-balance-row .comiccoin-label {
    font-size: 15px;
    color: #6c757d;
    font-weight: 500;
}

.comiccoin-widget-balance-row .comiccoin-value {
    font-size: 16px;
    color: #212529;
    font-weight: 600;
}

.comiccoin-widget-balance-highlight {
    color: #667eea !important;
    font-size: 20px !important;
    font-weight: 700 !important;
}

/* ===== Refresh Balance Link ===== */
.comiccoin-refresh-balance {
    font-size: 11px;
    color: #667eea;
    text-decoration: none;
    margin-left: 6px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-weight: 400;
}

.comiccoin-refresh-balance:hover {
    opacity: 1;
    text-decoration: underline;
}

.comiccoin-refresh-balance.comiccoin-refreshing {
    pointer-events: none;
    opacity: 0.4;
}

/* ===== Breakdown Table ===== */
.comiccoin-widget-breakdown {
    margin-bottom: 20px;
}

.comiccoin-widget-breakdown h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #495057;
    font-weight: 600;
}

.comiccoin-widget-breakdown table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

.comiccoin-widget-breakdown thead {
    background: #f8f9fa;
}

.comiccoin-widget-breakdown th {
    padding: 12px 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

.comiccoin-widget-breakdown td {
    padding: 12px 15px;
    font-size: 14px;
    color: #212529;
    border-bottom: 1px solid #f1f3f5;
}

.comiccoin-widget-breakdown tbody tr:last-child td {
    border-bottom: none;
}

.comiccoin-widget-breakdown tbody tr:hover {
    background: #f8f9fa;
}

.comiccoin-widget-breakdown .comiccoin-highlight-row {
    background: #e7f3ff !important;
}

.comiccoin-widget-breakdown .comiccoin-highlight-row td {
    color: #0066cc !important;
}

/* ===== Limitation Notice ===== */
.comiccoin-widget-limitation {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.comiccoin-widget-limitation strong {
    display: block;
    margin-bottom: 8px;
    color: #856404;
    font-size: 14px;
}

.comiccoin-widget-limitation .comiccoin-max-discount {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #856404;
    margin-bottom: 8px;
}

.comiccoin-widget-limitation .comiccoin-limitation-reason {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #856404;
    font-style: italic;
}

/* ===== Conversion Note ===== */
.comiccoin-widget-conversion {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: #e7f3ff;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 3px solid #0066cc;
}

.comiccoin-widget-conversion .comiccoin-info-icon {
    font-size: 18px;
}

.comiccoin-widget-conversion span:last-child {
    font-size: 14px;
    color: #004085;
    font-weight: 500;
}

/* ===== Earn Info ===== */
.comiccoin-widget-earn {
    background: #fff9e6;
    padding: 15px 20px;
    border-radius: 6px;
    border-left: 3px solid #ffc107;
    margin-bottom: 15px;
    font-size: 15px;
    font-weight: 400;
    color: #856404;
    line-height: 1.5;
}

/* ===== Optional Banner ===== */
.comiccoin-widget-optional-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #fff9e6;
    border: 2px solid #ffd700;
    border-radius: 6px;
    margin-bottom: 20px;
}

.comiccoin-widget-optional-banner .comiccoin-optional-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.comiccoin-widget-optional-banner span:last-child {
    font-size: 14px;
    color: #856404;
    font-weight: 500;
    line-height: 1.5;
}

/* ===== Redemption Form ===== */
.comiccoin-widget-input-group {
    margin-bottom: 15px;
}

.comiccoin-widget-input-group .comiccoin-label {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-size: 15px;
}

.comiccoin-widget-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.comiccoin-widget-input {
    flex: 1;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #333;
}

.comiccoin-widget-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.comiccoin-widget-apply-btn {
    padding: 12px 20px;
    background: #667eea;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comiccoin-widget-apply-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.comiccoin-widget-clear-btn {
    padding: 12px 20px;
    background: #6c757d;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comiccoin-widget-clear-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.comiccoin-widget-hint {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
}

/* ===== Preview & Error ===== */
.comiccoin-widget-preview {
    padding: 15px 20px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    color: #155724;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    display: none;
}

.comiccoin-widget-preview.active {
    display: block;
}

.comiccoin-widget-error {
    padding: 15px 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    display: none;
}

.comiccoin-widget-error.active {
    display: block;
}

.comiccoin-widget-separator {
    display: inline-block;
    margin: 0 8px;
    color: #28a745;
    font-weight: 700;
}

.comiccoin-widget-new-total {
    font-size: 20px;
    font-weight: 700;
    color: #155724;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

/* ===== Save Notice ===== */
.comiccoin-widget-save-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: #e7f3ff;
    border-left: 3px solid #0066cc;
    border-radius: 6px;
    margin-top: 15px;
}

.comiccoin-widget-save-notice .comiccoin-save-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.comiccoin-widget-save-notice span:last-child {
    font-size: 13px;
    color: #004085;
    font-weight: 500;
    line-height: 1.5;
}

/* ===== Zero Balance ===== */
.comiccoin-widget-zero-notice {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #6c757d;
}

.comiccoin-widget-zero-notice .comiccoin-zero-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.comiccoin-widget-zero-notice h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #495057;
    font-weight: 600;
}

.comiccoin-widget-zero-notice p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
}

/* ===== Logged Out ===== */
.comiccoin-widget-logged-out-notice {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #e7f3ff;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.comiccoin-widget-logged-out-notice .comiccoin-logged-out-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.comiccoin-widget-logged-out-notice p {
    margin: 0;
    font-size: 15px;
    color: #004085;
    font-weight: 500;
    line-height: 1.5;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .comiccoin-rewards-widget {
        padding: 15px 18px;
    }

    .comiccoin-widget-header h3 {
        font-size: 16px;
    }

    .comiccoin-widget-header .comiccoin-icon {
        font-size: 20px;
    }

    .comiccoin-widget-balance-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .comiccoin-widget-balance-highlight {
        font-size: 18px !important;
    }

    .comiccoin-widget-breakdown th,
    .comiccoin-widget-breakdown td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .comiccoin-widget-input-wrapper {
        flex-direction: column;
        width: 100%;
    }

    .comiccoin-widget-input {
        width: 100%;
    }

    .comiccoin-widget-apply-btn,
    .comiccoin-widget-clear-btn {
        width: 100%;
    }

    .comiccoin-widget-hint {
        font-size: 12px;
    }

    .comiccoin-widget-save-notice span:last-child {
        font-size: 12px;
    }

    .comiccoin-widget-zero-notice {
        flex-direction: column;
    }
}
