/**
 * WC Stock Display Manager - Frontend Styles
 */

/* ==========================================================================
   Stock indicator
   ========================================================================== */

.wcsdm-stock {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.4;
}

.wcsdm-stock .wcsdm-stock__row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
}

.wcsdm-stock .wcsdm-stock__indicator {
    display: inline-block !important;
    width: 10px !important;
    height: 10px !important;
    min-width: 10px !important;
    min-height: 10px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    position: relative;
}

/* Pulse animation for low and out of stock */
.wcsdm-stock--low-stock .wcsdm-stock__indicator,
.wcsdm-stock--out-of-stock .wcsdm-stock__indicator {
    animation: wcsdm-pulse 2s ease-in-out infinite;
}

@keyframes wcsdm-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Default colors (overridable via Elementor) */
.wcsdm-stock--in-stock .wcsdm-stock__indicator {
    background-color: #22c55e !important;
}

.wcsdm-stock--low-stock .wcsdm-stock__indicator {
    background-color: #f59e0b !important;
}

.wcsdm-stock--out-of-stock .wcsdm-stock__indicator {
    background-color: #ef4444 !important;
}

.wcsdm-stock .wcsdm-stock__text {
    font-weight: 500;
    white-space: nowrap;
}

.wcsdm-stock--low-stock .wcsdm-stock__text {
    color: #92400e;
}

.wcsdm-stock--out-of-stock .wcsdm-stock__text {
    color: #991b1b;
}

/* Delivery date — second row */
.wcsdm-stock .wcsdm-stock__delivery {
    display: block !important;
    font-size: 12px;
    font-weight: 400;
    color: #64748b;
    padding-left: 18px;
}

/* Actions row (inquiry button under delivery date) */
.wcsdm-stock .wcsdm-stock__actions {
    padding-left: 18px;
    margin-top: 4px;
}

/* ==========================================================================
   Inquiry trigger button (low stock)
   ========================================================================== */

.wcsdm-inquiry-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background-color: #1e293b;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
    margin-left: 8px;
}

.wcsdm-inquiry-trigger:hover {
    background-color: #334155;
    transform: translateY(-1px);
}

.wcsdm-inquiry-trigger:active {
    transform: translateY(0);
}

/* ==========================================================================
   Inquiry form (inline - out of stock)
   ========================================================================== */

.wcsdm-inquiry-form--inline {
    margin-top: 20px;
    padding: 24px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.wcsdm-inquiry-form__title {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

/* ==========================================================================
   Form fields (shared)
   ========================================================================== */

.wcsdm-form-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wcsdm-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}

.wcsdm-field label .required {
    color: #ef4444;
}

.wcsdm-field input[type="text"],
.wcsdm-field input[type="email"],
.wcsdm-field input[type="tel"],
.wcsdm-field textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1e293b;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.wcsdm-field input:focus,
.wcsdm-field textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.wcsdm-field textarea {
    resize: vertical;
    min-height: 70px;
}

/* Submit */
.wcsdm-field--submit {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.wcsdm-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #fff !important;
    background-color: #1e293b !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: 160px;
}

.wcsdm-submit:hover {
    background-color: #334155 !important;
}

.wcsdm-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wcsdm-form-message {
    font-size: 13px;
    font-weight: 500;
}

.wcsdm-form-message--success {
    color: #16a34a;
}

.wcsdm-form-message--error {
    color: #dc2626;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.wcsdm-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.wcsdm-modal[aria-hidden="false"] {
    display: flex;
}

.wcsdm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.wcsdm-modal__container {
    position: relative;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: wcsdm-modal-in 0.25s ease-out;
}

@keyframes wcsdm-modal-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.wcsdm-modal__close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s ease;
}

.wcsdm-modal__close:hover {
    color: #1e293b;
}

.wcsdm-modal__title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}

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

@media (max-width: 600px) {
    .wcsdm-stock {
        flex-wrap: wrap;
    }

    .wcsdm-inquiry-trigger {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
        justify-content: center;
    }

    .wcsdm-modal__container {
        padding: 24px 20px;
        width: 95%;
    }

    .wcsdm-field--submit {
        flex-direction: column;
        align-items: stretch;
    }

    .wcsdm-submit {
        width: 100%;
    }
}
