/**
 * Hello Middleton - Modal Components
 * High-end, responsive modal system for fast interactions.
 *
 * @package BuddyX_Child
 * @since 3.2.0
 */

@layer components {

    .hm-modal {
        position: fixed;
        inset: 0;
        z-index: var(--z-max);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: var(--space-4);
        opacity: 0;
        visibility: hidden;
        transition: all var(--duration-normal) var(--ease-out);
        pointer-events: none;
    }

    .hm-modal.open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .hm-modal-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(28, 25, 23, 0.6);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .hm-modal-content {
        position: relative;
        z-index: 2;
        width: 100%;
        max-width: 560px;
        background: var(--hm-bg-elevated);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-xl);
        overflow: hidden;
        transform: scale(0.95) translateY(20px);
        transition: all var(--duration-normal) var(--ease-spring);
    }

    .hm-modal.open .hm-modal-content {
        transform: scale(1) translateY(0);
    }

    .hm-modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-4) var(--space-6);
        border-bottom: 1px solid var(--hm-border);
    }

    .hm-modal-title {
        margin: 0;
        font-family: var(--font-display);
        font-size: var(--text-xl);
        color: var(--hm-text);
    }

    .hm-modal-close {
        background: none;
        border: none;
        color: var(--hm-text-muted);
        cursor: pointer;
        padding: var(--space-1);
        transition: color var(--duration-fast) var(--ease-out);
    }

    .hm-modal-close:hover {
        color: var(--hm-text);
    }

    /* ==========================================================================
       FAST POST SPECIFIC
       ========================================================================== */

    .hm-fast-post-body {
        padding: var(--space-6);
    }

    .hm-fp-user {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        margin-bottom: var(--space-4);
    }

    .hm-fp-avatar img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }

    .hm-fp-user-info {
        display: flex;
        flex-direction: column;
    }

    .hm-fp-name {
        font-weight: 700;
        font-size: var(--text-sm);
        color: var(--hm-text);
    }

    .hm-fp-privacy {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 0.7rem;
        color: var(--hm-text-muted);
        background: var(--hm-bg-subtle);
        padding: 2px 8px;
        border-radius: 4px;
        font-weight: 600;
    }

    #hmFastPostContent {
        width: 100%;
        min-height: 120px;
        border: none;
        resize: none;
        font-family: var(--font-body);
        font-size: var(--text-lg);
        color: var(--hm-text);
        background: transparent;
        padding: 0;
        margin-bottom: var(--space-4);
    }

    #hmFastPostContent:focus {
        outline: none;
    }

    .hm-fp-media-preview {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
        margin-bottom: var(--space-4);
    }

    .hm-fp-preview-thumb {
        width: 80px;
        height: 80px;
        object-fit: cover;
        border-radius: var(--radius-md);
        border: 1px solid var(--hm-border);
    }

    .hm-fp-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-top: var(--space-4);
        border-top: 1px solid var(--hm-border);
    }

    .hm-fp-tool-btn {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        background: var(--hm-bg-subtle);
        border: 1px solid var(--hm-border);
        padding: 8px 16px;
        border-radius: var(--radius-full);
        font-family: var(--font-body);
        font-size: var(--text-sm);
        font-weight: 600;
        color: var(--hm-text-secondary);
        cursor: pointer;
        transition: all var(--duration-fast) var(--ease-out);
    }

    .hm-fp-tool-btn:hover {
        background: var(--hm-accent-light);
        border-color: var(--hm-accent);
        color: var(--hm-accent);
    }

    .hm-fp-submit-btn {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        background: var(--hm-primary);
        color: white;
        border: none;
        padding: 10px 24px;
        border-radius: var(--radius-full);
        font-family: var(--font-body);
        font-size: var(--text-sm);
        font-weight: 700;
        cursor: pointer;
        transition: all var(--duration-fast) var(--ease-out);
        box-shadow: var(--shadow-md);
    }

    .hm-fp-submit-btn:hover {
        background: var(--hm-primary-hover);
        transform: translateY(-1px);
        box-shadow: var(--shadow-lg);
    }

    .hm-fp-submit-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
    }

    .hm-fp-status {
        padding: 0 var(--space-6) var(--space-4);
        font-size: var(--text-sm);
        text-align: center;
    }

    .hm-fp-status.success { color: var(--hm-success); }
    .hm-fp-status.error { color: var(--hm-danger); }
    .hm-fp-status.loading { color: var(--hm-primary); font-weight: 600; }

    /* Mobile specific modal adjustments */
    @media (max-width: 768px) {
        .hm-modal {
            padding: 0;
            align-items: flex-end;
        }

        .hm-modal-content {
            border-radius: var(--radius-xl) var(--radius-xl) 0 0;
            max-width: 100%;
            transform: translateY(100%);
        }

        .hm-modal.open .hm-modal-content {
            transform: translateY(0);
        }

        .hm-fast-post-body {
            padding: var(--space-4);
        }

        #hmFastPostContent {
            min-height: 160px;
        }
    }

}
