/**
 * Zen Forms - Modal & Button Styles
 * Version: 1.0.0
 */

/* ========================================
   POPUP BUTTON STYLES
======================================== */

.zen-form-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    text-decoration: none;
    line-height: 1.4;

    /* CSS Custom Properties for colors (set inline via style attribute) */
    background-color: var(--zfb-bg, #646B3A);
    color: var(--zfb-text, #ffffff);
    border-radius: var(--zfb-radius, 8px);
}

.zen-form-button:hover {
    background-color: var(--zfb-bg-hover, #4d5229);
    color: var(--zfb-text-hover, #ffffff);
}

.zen-form-button:active {
    transform: scale(0.98);
}

.zen-form-button:focus {
    outline: 2px solid var(--zfb-bg, #646B3A);
    outline-offset: 2px;
}

.zen-form-button:focus:not(:focus-visible) {
    outline: none;
}

.zen-form-button:focus-visible {
    outline: 2px solid var(--zfb-bg, #646B3A);
    outline-offset: 2px;
}

/* Button Sizes */
.zen-form-button--sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.zen-form-button--md {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.zen-form-button--lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Dashicons in buttons */
.zen-form-button .dashicons {
    font-size: inherit;
    width: auto;
    height: auto;
    line-height: 1;
    vertical-align: middle;
}

.zen-form-button--sm .dashicons {
    font-size: 16px;
}

.zen-form-button--md .dashicons {
    font-size: 18px;
}

.zen-form-button--lg .dashicons {
    font-size: 20px;
}

/* ========================================
   MODAL STYLES
======================================== */

.zen-form-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.zen-form-modal.zen-form-modal--open {
    display: flex;
}

/* Backdrop */
.zen-form-modal__backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1;
}

/* Container */
.zen-form-modal__container {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    margin: 1rem;
    overflow-y: auto;
    z-index: 2;
    animation: zenFormModalSlideIn 0.3s ease;
}

@keyframes zenFormModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content */
.zen-form-modal__content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
}

/* Close Button */
.zen-form-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
    padding: 0;
}

.zen-form-modal__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.zen-form-modal__close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Header */
.zen-form-modal__header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    padding: 28px 24px 24px;
    color: #fff;
}

.zen-form-modal__header h3 {
    margin: 0 0 8px;
    padding: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}

.zen-form-modal__header p {
    margin: 0;
    padding: 0;
    opacity: 0.9;
    font-size: 0.95rem;
    color: #fff;
    line-height: 1.5;
}

/* Body */
.zen-form-modal__body {
    padding: 24px;
    background: #fff;
}

/* Reset form styles inside modal */
.zen-form-modal__body .zen-form {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Body Scroll Lock */
body.zen-form-modal-open {
    overflow: hidden;
}

/* iOS scroll lock fix */
body.zen-form-modal-open {
    position: fixed;
    width: 100%;
}

/* ========================================
   MOBILE RESPONSIVE
======================================== */

@media (max-width: 640px) {
    .zen-form-modal__container {
        margin: 0.5rem;
        max-height: 95vh;
    }

    .zen-form-modal__header {
        padding: 20px 16px;
    }

    .zen-form-modal__header h3 {
        font-size: 1.25rem;
    }

    .zen-form-modal__body {
        padding: 16px;
    }

    .zen-form-modal__close {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
        font-size: 24px;
    }

    /* Button size adjustments for mobile */
    .zen-form-button--lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* ========================================
   DARK MODE SUPPORT
======================================== */

@media (prefers-color-scheme: dark) {
    .zen-form-modal__content {
        background: #1f2937;
    }

    .zen-form-modal__body {
        background: #1f2937;
    }

    .zen-form-modal__header {
        background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    }
}

/* ========================================
   ACCESSIBILITY
======================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .zen-form-modal__container {
        animation: none;
    }

    .zen-form-button {
        transition: none;
    }
}
