/* ==========================================================================
   CP CORE - SHARED CONFIRMATION MODAL SYSTEM
   
   Replaces browser confirm() dialogs with styled, branded confirmation modals.
   Supports both centered and relative positioning.
   
   @package CP_Core
   @since 1.0.0
   ========================================================================== */

/* Import shared variables from cp-core */
@import url('./shared-variables.css');

/* ==========================================================================
   MODAL CONTAINER
   ========================================================================== */

.cp-confirmation-modal {
    display: none;
    position: fixed;
    z-index: var(--cp-z-modal);
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: cp-confirmation-fade-in 0.3s ease-out;
    isolation: isolate;
    align-items: center;
    justify-content: center;
}

.cp-confirmation-modal.show {
    display: flex;
}

/* Centered positioning (default) */
.cp-confirmation-modal--centered {
    align-items: center;
    justify-content: center;
}

/* Relative positioning */
.cp-confirmation-modal--relative {
    background: transparent;
    backdrop-filter: none;
}

/* ==========================================================================
   MODAL CONTENT
   ========================================================================== */

.cp-confirmation-content {
    position: relative;
    background: #fff;
    padding: var(--cp-spacing-lg);
    border-radius: var(--cp-radius-md);
    max-width: 360px;
    width: 90vw;
    box-shadow: var(--cp-shadow-modal);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: cp-confirmation-slide-up 0.4s ease-out;
    transform-origin: center;
    font-family: var(--cp-font-family);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Relative positioning content */
.cp-confirmation-modal--relative .cp-confirmation-content {
    position: absolute;
    animation: cp-confirmation-slide-in 0.3s ease-out;
    max-width: 320px;
    width: auto;
    min-width: 280px;
}

/* ==========================================================================
   MODAL HEADER
   ========================================================================== */

.cp-confirmation-header {
    display: flex;
    align-items: center;
    gap: var(--cp-spacing-sm);
    margin-bottom: var(--cp-spacing-md);
    padding-bottom: var(--cp-spacing-sm);
    border-bottom: 1px solid #f0f0f0;
}

.cp-confirmation-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
}

.cp-confirmation-icon--warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.cp-confirmation-icon--danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.cp-confirmation-icon--info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.cp-confirmation-title {
    margin: 0 !important;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    flex: 1;
}

/* ==========================================================================
   MODAL BODY
   ========================================================================== */

.cp-confirmation-message {
    margin: 0 0 var(--cp-spacing-lg) 0;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ==========================================================================
   MODAL ACTIONS
   ========================================================================== */

.cp-confirmation-actions {
    display: flex;
    gap: var(--cp-spacing-sm);
    justify-content: flex-end;
    margin-top: var(--cp-spacing-md);
    padding-top: var(--cp-spacing-sm);
    border-top: 1px solid #eee;
}

.cp-confirmation-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 1em !important;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    font-family: var(--cp-font-family);
}

.cp-confirmation-btn--primary {
    background: var(--cp-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(129, 35, 18, 0.3);
}

.cp-confirmation-btn--primary:hover {
    background: var(--cp-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(129, 35, 18, 0.4);
}

.cp-confirmation-btn--primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(129, 35, 18, 0.3);
}

.cp-confirmation-btn--secondary {
    background: var(--cp-btn-secondary-bg);
    color: var(--cp-btn-secondary-text);
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.cp-confirmation-btn--secondary:hover {
    background: var(--cp-btn-secondary-hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.4);
}

.cp-confirmation-btn--secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.cp-confirmation-btn--danger {
    background: var(--cp-danger);
    color: white;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.cp-confirmation-btn--danger:hover {
    background: var(--cp-danger-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.4);
}

.cp-confirmation-btn--danger:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes cp-confirmation-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes cp-confirmation-slide-up {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cp-confirmation-slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media screen and (max-width: 480px) {
    .cp-confirmation-content {
        margin: var(--cp-spacing-lg);
        padding: var(--cp-spacing-lg);
        width: calc(100vw - 32px);
        max-width: none;
    }
    
    .cp-confirmation-actions {
        flex-direction: column;
        gap: var(--cp-spacing-xs);
    }
    
    .cp-confirmation-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.cp-confirmation-modal:focus {
    outline: none;
}

.cp-confirmation-btn:focus-visible {
    outline: 2px solid var(--cp-primary);
    outline-offset: 2px;
}

/* Screen reader only text */
.cp-confirmation-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   BODY MODAL STATE
   ========================================================================== */

body.cp-confirmation-modal-open {
    overflow: hidden;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .cp-confirmation-modal {
        display: none !important;
    }
    
    body.cp-confirmation-modal-open {
        overflow: visible;
    }
}
