/**
 * Custom Coupons Field - Frontend Styles
 * Metodologia BEM (Block Element Modifier)
 * Version: 1.0.0
 */

/* ==========================================================================
   Block: ccf-coupon
   ========================================================================== */

.ccf-coupon {
    margin: 20px 0;
    padding: 20px;
    background: #d3b8bd;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: all 0.3s ease;
}
input#ccf_coupon_code_below {
    background: #f7f7f7;
}

.ccf-coupon:hover {
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

button.ccf-coupon__button {
    background: #e9d6c7;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Modifiers dla pozycji
   ========================================================================== */

.ccf-coupon--above {
    margin-bottom: 25px;
}

.ccf-coupon--below {
    margin-top: 25px;
}

/* ==========================================================================
   Element: ccf-coupon__text
   ========================================================================== */

.ccf-coupon__text {
    margin: 0 0 15px 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.ccf-coupon__text p {
    margin: 0 0 10px 0;
}

.ccf-coupon__text p:last-child {
    margin-bottom: 0;
}

/* Modifiers dla tekstu
   ========================================================================== */

.ccf-coupon__text--before {
    margin-bottom: 15px;
}

.ccf-coupon__text--after {
    margin-top: 15px;
    margin-bottom: 0;
    font-size: 13px;
    color: #666;
}

/* ==========================================================================
   Element: ccf-coupon__form
   ========================================================================== */

.ccf-coupon__form {
    width: 100%;
}

/* ==========================================================================
   Element: ccf-coupon__input-wrapper
   ========================================================================== */

.ccf-coupon__input-wrapper {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

/* ==========================================================================
   Element: ccf-coupon__input
   ========================================================================== */

.ccf-coupon__input {
    flex: 1;
    padding: 12px 15px;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.ccf-coupon__input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.ccf-coupon__input::placeholder {
    color: #999;
    opacity: 1;
}

/* Modifiers dla input
   ========================================================================== */

.ccf-coupon__input--error {
    border-color: #dc3232;
    background-color: #fff5f5;
}

.ccf-coupon__input--error:focus {
    border-color: #dc3232;
    box-shadow: 0 0 0 1px #dc3232;
}

/* ==========================================================================
   Element: ccf-coupon__button
   ========================================================================== */

.ccf-coupon__button {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    text-align: center;
    background-color: #007cba;
    border: 2px solid #007cba;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-sizing: border-box;
}

.ccf-coupon__button:hover {
    background-color: #005a87;
    border-color: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.ccf-coupon__button:active {
    transform: translateY(0);
    box-shadow: none;
}

.ccf-coupon__button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.2);
}

.ccf-coupon__button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Modifiers dla button
   ========================================================================== */

.ccf-coupon__button--loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.ccf-coupon__button--loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: ccf-spin 0.6s linear infinite;
}

@keyframes ccf-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

/* Tablet
   ========================================================================== */

@media (max-width: 768px) {
    .ccf-coupon {
        padding: 15px;
        margin: 15px 0;
    }

    .ccf-coupon__input-wrapper {
        flex-direction: column;
        gap: 8px;
    }

    .ccf-coupon__input,
    .ccf-coupon__button {
        width: 100%;
    }

    .ccf-coupon__button {
        padding: 14px 20px;
    }
}

/* Mobile
   ========================================================================== */

@media (max-width: 480px) {
    .ccf-coupon {
        padding: 12px;
        margin: 12px 0;
    }

    .ccf-coupon__text {
        font-size: 13px;
    }

    .ccf-coupon__text--after {
        font-size: 12px;
    }

    .ccf-coupon__input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 12px;
    }

    .ccf-coupon__button {
        padding: 12px 18px;
        font-size: 16px; /* Better touch target */
    }
}
/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .ccf-coupon {
        display: none;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.ccf-coupon__input:focus-visible,
.ccf-coupon__button:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .ccf-coupon {
        border-width: 2px;
    }

    .ccf-coupon__input,
    .ccf-coupon__button {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ccf-coupon,
    .ccf-coupon__input,
    .ccf-coupon__button {
        transition: none;
    }

    .ccf-coupon__button--loading::after {
        animation: none;
    }
}
