/* =========================================
   COSPLAY MODAL SYSTEM (Unified)
   ========================================= */

:root {
    --modal-z-index: 10001;
    /* Above reviews-panel (10000) and Toasts */
    --modal-overlay-bg: rgba(0, 0, 0, 0.75);
    --modal-glass-bg: rgba(20, 20, 30, 0.95);
    --modal-border: 1px solid rgba(255, 255, 255, 0.1);
    --modal-glow: 0 0 20px rgba(139, 92, 246, 0.3);
    /* Purple Glow */
    --modal-radius: 16px;
    --modal-transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- OVERLAY --- */
.cosplay-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: var(--modal-z-index);

    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cosplay-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- MODAL CONTAINER --- */
.cosplay-modal {
    background: var(--modal-glass-bg);
    border: var(--modal-border);
    border-radius: var(--modal-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), var(--modal-glow);
    color: #fff;
    width: 90%;
    max-width: 500px;

    transform: scale(0.95) translateY(10px);
    opacity: 0;
    transition: var(--modal-transition);

    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cosplay-modal-overlay.active .cosplay-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* --- SIZES --- */
.cosplay-modal.modal-sm {
    max-width: 400px;
}

.cosplay-modal.modal-md {
    max-width: 600px;
}

.cosplay-modal.modal-lg {
    max-width: 800px;
}

/* --- CONTENT --- */
.cosplay-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cosplay-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cosplay-modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.cosplay-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.cosplay-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 70vh;
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.cosplay-modal-footer {
    padding: 1.25rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* --- INPUTS IN PROMPTS --- */
.cosplay-modal-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    margin-top: 1rem;
    transition: all 0.2s;
}

.cosplay-modal-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

/* --- BUTTONS --- */
.cosplay-modal-btn {
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    border: none;
}

.cosplay-modal-btn.cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.cosplay-modal-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.cosplay-modal-btn.confirm {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.cosplay-modal-btn.confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.cosplay-modal-btn.danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.cosplay-modal-btn.danger:hover {
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

/* --- MOBILE --- */
@media (max-width: 640px) {
    .cosplay-modal {
        width: 100%;
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        margin-top: auto;
        /* Drawer style */
        transform: translateY(100%);
        border-bottom: none;
    }

    .cosplay-modal-overlay {
        align-items: flex-end;
        /* Drawer alignment */
    }
}