/**
 * Product Coupons – Frontend Styles
 *
 * @package WC_Product_Coupons
 */

/* ========== Cards Container ========== */
.wcpc-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 20px 0;
    max-width: 100%;
}

/* Hidden until JS repositions the container in the DOM. */
.wcpc-cards-container.wcpc-position-pending {
    display: none !important;
}

/* ========== Layout Directions ========== */
/* Horizontal (default): side by side */
.wcpc-cards-container.wcpc-layout-horizontal {
    flex-direction: row;
}

.wcpc-cards-container.wcpc-layout-horizontal .wcpc-card {
    flex: 1 1 280px;
    min-width: 200px;
}

/* Vertical: stacked on top of each other */
.wcpc-cards-container.wcpc-layout-vertical {
    flex-direction: column;
}

.wcpc-cards-container.wcpc-layout-vertical .wcpc-card {
    flex: 0 0 auto;
    width: 100%;
}

/* Grid: auto-fill responsive grid */
.wcpc-cards-container.wcpc-layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* ========== Card ========== */
.wcpc-card {
    position: relative;
    overflow: hidden;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
    flex: 1 1 280px;
    min-width: 200px;
}

.wcpc-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* When a card has a custom width set via inline style, don't let flex override */
.wcpc-card[style*="width"] {
    flex: 0 0 auto;
}

/* ========== Card Header ========== */
.wcpc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 8px;
}

.wcpc-card-title {
    font-size: inherit;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

/* ========== Badge ========== */
.wcpc-card-badge {
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transform: rotate(-2deg);
    flex-shrink: 0;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* ========== Subtitle ========== */
.wcpc-card-subtitle {
    font-size: 14px;
    margin: 0 0 16px;
    line-height: 1.4;
}

/* ========== Code Box ========== */
.wcpc-card-code-box {
    padding: 12px 16px;
    text-align: center;
    margin-bottom: 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    user-select: all;
    -webkit-user-select: all;
}

.wcpc-card-code-box:hover {
    filter: brightness(0.96);
}

.wcpc-card-code-box:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.wcpc-coupon-code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    display: block;
    background: none;
    padding: 0;
}

/* ========== Buttons ========== */
.wcpc-card-actions {
    display: flex;
    gap: 8px;
}

.wcpc-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    color: #fff;
    transition: filter 0.15s ease, opacity 0.15s ease;
    line-height: 1.4;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wcpc-btn:hover {
    filter: brightness(1.1);
}

.wcpc-btn:active {
    filter: brightness(0.9);
}

.wcpc-btn:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.wcpc-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.wcpc-btn-apply {
    background-color: #96588A;
}

.wcpc-btn-apply:hover {
    background-color: #7d4b74;
}

/* ========== Toast Notifications ========== */
.wcpc-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.wcpc-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    color: #fff;
    min-width: 260px;
    max-width: 380px;
    pointer-events: auto;
    animation: wcpc-toast-in 0.3s ease-out;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wcpc-toast.wcpc-toast-out {
    opacity: 0;
    transform: translateX(20px);
}

@keyframes wcpc-toast-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wcpc-toast-success {
    background-color: #22c55e;
}

.wcpc-toast-error {
    background-color: #ef4444;
}

.wcpc-toast-warning {
    background-color: #f59e0b;
    color: #1a1a1a;
}

.wcpc-toast-info {
    background-color: #3b82f6;
}

.wcpc-toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.wcpc-toast-message {
    flex: 1;
}

.wcpc-toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    opacity: 0.8;
    flex-shrink: 0;
    line-height: 1;
}

.wcpc-toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* ========== Mobile Visibility ========== */
@media screen and (max-width: 767px) {
    .wcpc-hide-mobile {
        display: none !important;
    }

    .wcpc-cards-container {
        flex-direction: column !important;
        margin-left: 0;
        margin-right: 0;
    }

    .wcpc-cards-container.wcpc-layout-grid {
        display: flex !important;
    }

    .wcpc-card {
        max-width: 100% !important;
        width: 100% !important;
        flex: 1 1 100% !important;
    }

    .wcpc-card-actions {
        flex-direction: column;
    }

    .wcpc-btn {
        width: 100%;
    }
}

/* ========== Reduced Motion ========== */
@media (prefers-reduced-motion: reduce) {

    .wcpc-card,
    .wcpc-toast,
    .wcpc-toast.wcpc-toast-out {
        transition: none;
        animation: none;
    }
}


