/**
 * Comments Button Styles
 *
 * Styles for the [bouton_commentaires] shortcode.
 *
 * @package JMV_Child
 */

/* Button styles */
.jmv-comment-btn {
    display: inline-block;
    background-color: transparent;
    font-size: 16px;
    font-weight: 300;
    text-transform: uppercase;
    color: #004AFF;
    border: 1px solid #004AFF;
    border-radius: 0;
    padding: 13px 13px;
    cursor: pointer;
    transition: background 160ms ease;
    font-family: inherit;
}

.jmv-comment-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Modal overlay */
.jmv-comment-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    place-items: center;
    padding: clamp(20px, 4vw, 48px);
    background: linear-gradient(140deg, rgba(9, 31, 84, 0.78), rgba(0, 74, 255, 0.55));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 999999;
    animation: jmv-overlayFade 220ms ease-out;
}

.jmv-comment-modal-overlay.active {
    display: grid;
}

/* Modal container */
.jmv-comment-modal {
    position: relative;
    width: min(640px, 100%);
    border-radius: 28px;
    padding: clamp(28px, 6vw, 48px);
    background: linear-gradient(155deg, #ffffff 8%, #f6f8ff 45%, #ffffff 100%);
    border: 1px solid rgba(0, 74, 255, 0.16);
    box-shadow: 0 40px 88px rgba(9, 31, 84, 0.45);
    color: #091F54;
    overflow: hidden;
    animation: jmv-dialogFloat 260ms cubic-bezier(0.21, 0.61, 0.35, 1);
}

.jmv-comment-modal::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(0, 74, 255, 0.08) 0%, rgba(108, 148, 245, 0.05) 55%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    z-index: 0;
}

/* Glow effect */
.jmv-comment-glow {
    position: absolute;
    top: -28%;
    right: -12%;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(108, 148, 245, 0.55) 0%, rgba(0, 74, 255, 0) 65%);
    pointer-events: none;
    z-index: 0;
}

/* Close button */
.jmv-comment-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(0, 74, 255, 0.18);
    background: rgba(255, 255, 255, 0.88);
    color: #091F54;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
    box-shadow: 0 8px 22px rgba(9, 31, 84, 0.12);
    z-index: 2;
    font-size: 0;
}

.jmv-comment-modal-close::before,
.jmv-comment-modal-close::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.jmv-comment-modal-close::before {
    transform: rotate(45deg);
}

.jmv-comment-modal-close::after {
    transform: rotate(-45deg);
}

.jmv-comment-modal-close:hover {
    transform: translateY(-2px);
    background: #004AFF;
    color: #fff;
    border-color: transparent;
    box-shadow: 0 18px 30px rgba(0, 74, 255, 0.38);
}

/* Header */
.jmv-comment-header {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
}

.jmv-comment-subtitle {
    font-size: 12px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(9, 31, 84, 0.55);
    margin: 0;
}

.jmv-comment-title {
    margin: 0;
    font-size: clamp(28px, 4vw, 36px);
    font-weight: 300;
    line-height: 1.1;
    color: #091F54;
}

.jmv-comment-desc {
    margin: 0;
    font-size: 16px;
    line-height: 1.7;
    color: rgba(9, 31, 84, 0.72);
}

/* Form styles */
.jmv-comment-form {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.jmv-comment-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.jmv-comment-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 240px;
}

.jmv-comment-field label {
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(9, 31, 84, 0.75);
}

.jmv-comment-field input,
.jmv-comment-field textarea {
    appearance: none;
    border: 1px solid rgba(0, 74, 255, 0.18);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    padding: 16px 18px;
    font-size: 16px;
    line-height: 1.5;
    color: #091F54;
    font-family: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
    box-shadow: inset 0 1px 2px rgba(9, 31, 84, 0.06), 0 1px 1px rgba(255, 255, 255, 0.9);
}

.jmv-comment-field input::placeholder,
.jmv-comment-field textarea::placeholder {
    color: rgba(9, 31, 84, 0.45);
}

.jmv-comment-field input:focus,
.jmv-comment-field textarea:focus {
    outline: none;
    border-color: #004AFF;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 74, 255, 0.12), 0 18px 34px rgba(0, 74, 255, 0.18);
}

.jmv-comment-field textarea {
    min-height: 160px;
    resize: vertical;
}

/* Action buttons */
.jmv-comment-actions {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    padding-top: 8px;
}

.jmv-comment-cancel {
    border: 1px solid rgba(9, 31, 84, 0.42);
    background: transparent;
    color: #091F54;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    font-size: 15px;
    letter-spacing: 0.08em;
    padding: 13px 26px;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
    font-family: inherit;
}

.jmv-comment-cancel:hover {
    background: rgba(9, 31, 84, 0.08);
    border-color: rgba(9, 31, 84, 0.62);
}

.jmv-comment-submit {
    border: 1px solid #004AFF;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 32px;
    text-transform: uppercase;
    font-size: 15px;
    letter-spacing: 0.08em;
    color: #ffffff;
    background: #004AFF;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
    font-family: inherit;
}

.jmv-comment-submit:hover {
    background: #ffffff;
    color: #004AFF;
}

.jmv-comment-submit:disabled {
    background-color: #ccc;
    border-color: #ccc;
    color: #fff;
    cursor: not-allowed;
}

.jmv-comment-submit .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: jmv-comment-spin 0.8s linear infinite;
}

.jmv-comment-submit.loading .spinner {
    display: inline-block;
}

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

@keyframes jmv-overlayFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes jmv-dialogFloat {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Message display */
.jmv-comment-message {
    display: none;
    padding: 12px 16px;
    margin-top: 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.jmv-comment-message.success {
    display: block;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.jmv-comment-message.error {
    display: block;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Success state */
.jmv-comment-success-state {
    display: none;
    position: relative;
    z-index: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    min-height: 280px;
    animation: jmv-successFadeIn 400ms ease-out;
}

.jmv-comment-success-state.active {
    display: flex;
}

.jmv-comment-success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    box-shadow: 0 12px 40px rgba(16, 185, 129, 0.35);
    animation: jmv-iconPop 500ms cubic-bezier(0.34, 1.56, 0.64, 1) 100ms both;
}

.jmv-comment-success-icon::before {
    content: "";
    width: 24px;
    height: 40px;
    border: 4px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-4px);
    animation: jmv-checkDraw 300ms ease-out 400ms both;
}

.jmv-comment-success-title {
    margin: 0 0 12px 0;
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 300;
    line-height: 1.2;
    color: #091F54;
}

.jmv-comment-success-text {
    margin: 0 0 32px 0;
    font-size: 16px;
    line-height: 1.6;
    color: rgba(9, 31, 84, 0.72);
    max-width: 400px;
}

.jmv-comment-success-close {
    border: 1px solid #004AFF;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 32px;
    text-transform: uppercase;
    font-size: 15px;
    letter-spacing: 0.08em;
    color: #004AFF;
    background: transparent;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease;
    font-family: inherit;
}

.jmv-comment-success-close:hover {
    background: #004AFF;
    color: #fff;
}

@keyframes jmv-successFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes jmv-iconPop {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes jmv-checkDraw {
    from {
        opacity: 0;
        clip-path: inset(100% 0 0 0);
    }
    to {
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

/* Hide form content when success */
.jmv-comment-modal.success-submitted .jmv-comment-header,
.jmv-comment-modal.success-submitted .jmv-comment-form {
    display: none;
}

/* Responsive */
@media (max-width: 640px) {
    .jmv-comment-modal-overlay {
        padding: 16px;
    }

    .jmv-comment-modal {
        border-radius: 22px;
        padding: 28px 22px;
    }

    .jmv-comment-glow {
        top: -34%;
        right: -32%;
        width: 420px;
        height: 420px;
    }

    .jmv-comment-row {
        flex-direction: column;
    }

    .jmv-comment-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .jmv-comment-cancel,
    .jmv-comment-submit {
        width: 100%;
        justify-content: center;
    }

    .jmv-comment-modal-close {
        top: 12px;
        right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .jmv-comment-modal-overlay {
        animation: none;
    }
    .jmv-comment-modal {
        animation: none;
    }
    .jmv-comment-submit,
    .jmv-comment-cancel,
    .jmv-comment-modal-close,
    .jmv-comment-field input,
    .jmv-comment-field textarea {
        transition: none;
    }
}
