/**
 * GRAPHIC VIEW â€” Global Confirmation, Unsaved Changes & Toast Feedback System
 * Emerald (#10B981) and Navy (#0B1B3D) Design System
 * Developed by: Web Era Solutions | Made with â ¤ï¸  by Web Era Solutions
 */

/* ==========================================================================
   1. GLOBAL CONFIRMATION MODAL & BACKDROP
   ========================================================================== */

.gv-confirm-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    background: rgba(11, 27, 61, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1060;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

.gv-confirm-backdrop.gv-show {
    opacity: 1;
    visibility: visible;
}

.gv-confirm-dialog-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1065;
    padding: 16px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

.gv-confirm-dialog-wrapper.gv-show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.gv-confirm-modal {
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 20px 48px -10px rgba(11, 27, 61, 0.28), 0 0 0 1px rgba(11, 27, 61, 0.05);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    transform: scale(0.92) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    pointer-events: auto;
}

.gv-confirm-dialog-wrapper.gv-show .gv-confirm-modal {
    transform: scale(1) translateY(0);
}

/* Modal Header & Icon Styles */
.gv-confirm-body {
    padding: 28px 28px 20px 28px;
    text-align: center;
}

.gv-confirm-icon-box {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 18px;
    transition: transform 0.2s ease;
}

/* Action Type Themes */
/* 1. Delete / Destructive Action */
.gv-theme-delete .gv-confirm-icon-box {
    background: #FEE2E2;
    color: #DC2626;
    border: 2px solid #FECACA;
}
.gv-theme-delete .gv-btn-confirm {
    background: #DC2626;
    color: #FFFFFF;
    border: none;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}
.gv-theme-delete .gv-btn-confirm:hover {
    background: #B91C1C;
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.45);
}

/* 2. Save Action */
.gv-theme-save .gv-confirm-icon-box {
    background: #D1FAE5;
    color: #059669;
    border: 2px solid #A7F3D0;
}
.gv-theme-save .gv-btn-confirm {
    background: #10B981;
    color: #FFFFFF;
    border: none;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}
.gv-theme-save .gv-btn-confirm:hover {
    background: #059669;
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

/* 3. Update Action */
.gv-theme-update .gv-confirm-icon-box {
    background: #DBEAFE;
    color: #2563EB;
    border: 2px solid #BFDBFE;
}
.gv-theme-update .gv-btn-confirm {
    background: #0B1B3D;
    color: #FFFFFF;
    border: none;
    box-shadow: 0 4px 14px rgba(11, 27, 61, 0.35);
}
.gv-theme-update .gv-btn-confirm:hover {
    background: #1E3A8A;
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(11, 27, 61, 0.45);
}

/* 4. Publish Action */
.gv-theme-publish .gv-confirm-icon-box {
    background: #CCFBF1;
    color: #0D9488;
    border: 2px solid #99F6E4;
}
.gv-theme-publish .gv-btn-confirm {
    background: #0D9488;
    color: #FFFFFF;
    border: none;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}
.gv-theme-publish .gv-btn-confirm:hover {
    background: #0F766E;
    color: #FFFFFF;
}

/* 5. Approve Action */
.gv-theme-approve .gv-confirm-icon-box {
    background: #DCFCE7;
    color: #16A34A;
    border: 2px solid #BBF7D0;
}
.gv-theme-approve .gv-btn-confirm {
    background: #16A34A;
    color: #FFFFFF;
    border: none;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
}
.gv-theme-approve .gv-btn-confirm:hover {
    background: #15803D;
    color: #FFFFFF;
}

/* 6. Reject Action */
.gv-theme-reject .gv-confirm-icon-box {
    background: #FEE2E2;
    color: #DC2626;
    border: 2px solid #FECACA;
}
.gv-theme-reject .gv-btn-confirm {
    background: #DC2626;
    color: #FFFFFF;
    border: none;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}
.gv-theme-reject .gv-btn-confirm:hover {
    background: #B91C1C;
    color: #FFFFFF;
}

/* 7. Warning & Unsaved Changes Action */
.gv-theme-warning .gv-confirm-icon-box {
    background: #FEF3C7;
    color: #D97706;
    border: 2px solid #FDE68A;
}
.gv-theme-warning .gv-btn-confirm {
    background: #D97706;
    color: #FFFFFF;
    border: none;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}
.gv-theme-warning .gv-btn-confirm:hover {
    background: #B45309;
    color: #FFFFFF;
}

/* Title & Description */
.gv-confirm-title {
    font-size: 19px;
    font-weight: 700;
    color: #0B1B3D;
    margin-bottom: 8px;
    line-height: 1.35;
}

.gv-confirm-message {
    font-size: 14.5px;
    color: #64748B;
    line-height: 1.55;
    margin-bottom: 14px;
}

/* Item highlight callout */
.gv-confirm-item-callout {
    background: #F8FAFC;
    border: 1px dashed #CBD5E1;
    border-radius: 12px;
    padding: 10px 14px;
    margin: 12px 0 16px 0;
    font-size: 13.5px;
    color: #1E293B;
    word-break: break-word;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gv-theme-delete .gv-confirm-item-callout {
    background: #FFF1F2;
    border-color: #FECDD3;
    color: #9F1239;
}

.gv-confirm-consequence {
    font-size: 12.5px;
    color: #94A3B8;
    margin-top: 6px;
    line-height: 1.4;
}

/* Modal Actions Footer */
.gv-confirm-footer {
    padding: 16px 28px 24px 28px;
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.gv-btn-modal {
    flex: 1;
    padding: 11px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
    outline: none;
}

.gv-btn-cancel {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #E2E8F0;
}

.gv-btn-cancel:hover {
    background: #E2E8F0;
    color: #1E293B;
}

.gv-btn-modal:focus-visible {
    outline: 2px solid #2563EB;
    outline-offset: 2px;
}

/* Loading state on action button */
.gv-btn-confirm.gv-loading {
    opacity: 0.85;
    pointer-events: none;
    cursor: not-allowed;
}

.gv-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: gvSpin 0.75s linear infinite;
    display: inline-block;
}

@keyframes gvSpin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   2. MOBILE RESPONSIVE BOTTOM SHEET ADAPTATION (≤ 576px)
   ========================================================================== */

@media (max-width: 576px) {
    .gv-confirm-dialog-wrapper {
        align-items: flex-end;
        padding: 0;
    }

    .gv-confirm-modal {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        margin-bottom: 0;
        transform: translateY(100%);
        box-shadow: 0 -10px 40px rgba(11, 27, 61, 0.3);
        padding-bottom: env(safe-area-inset-bottom, 16px);
    }

    .gv-confirm-dialog-wrapper.gv-show .gv-confirm-modal {
        transform: translateY(0);
    }

    .gv-confirm-modal::before {
        content: '';
        display: block;
        width: 44px;
        height: 4px;
        background: #CBD5E1;
        border-radius: 999px;
        margin: 12px auto 4px auto;
    }

    .gv-confirm-body {
        padding: 16px 20px 16px 20px;
    }

    .gv-confirm-footer {
        padding: 12px 20px 20px 20px;
        flex-direction: column-reverse;
    }

    .gv-btn-modal {
        width: 100%;
        padding: 13px 20px;
        font-size: 15px;
    }
}

/* ==========================================================================
   3. CENTRALIZED TOAST NOTIFICATION SYSTEM
   ========================================================================== */

.gv-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1099;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.gv-toast-card {
    background: #FFFFFF;
    border-radius: 14px;
    box-shadow: 0 10px 30px -5px rgba(11, 27, 61, 0.18), 0 0 0 1px rgba(11, 27, 61, 0.06);
    border-left: 5px solid #10B981;
    overflow: hidden;
    pointer-events: auto;
    position: relative;
    opacity: 0;
    transform: translateX(40px) scale(0.96);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.gv-toast-card.gv-show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.gv-toast-card.gv-hide {
    opacity: 0;
    transform: translateX(40px) scale(0.96);
}

.gv-toast-main {
    display: flex;
    align-items: flex-start;
    padding: 14px 16px 12px 16px;
    gap: 12px;
}

.gv-toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.gv-toast-content {
    flex: 1;
    min-width: 0;
}

.gv-toast-title {
    font-size: 14px;
    font-weight: 700;
    color: #0B1B3D;
    margin-bottom: 2px;
    line-height: 1.3;
}

.gv-toast-message {
    font-size: 13px;
    color: #475569;
    line-height: 1.45;
    word-break: break-word;
}

.gv-toast-close {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.gv-toast-close:hover {
    color: #0B1B3D;
}

/* Progress bar countdown */
.gv-toast-progress-bar {
    height: 3px;
    width: 100%;
    background: rgba(0, 0, 0, 0.06);
    position: relative;
}

.gv-toast-progress-fill {
    height: 100%;
    width: 100%;
    transform-origin: left;
    transition: width 4.5s linear;
}

/* Toast Varieties */
.gv-toast-success {
    border-left-color: #10B981;
}
.gv-toast-success .gv-toast-icon {
    background: #D1FAE5;
    color: #059669;
}
.gv-toast-success .gv-toast-progress-fill {
    background: #10B981;
}

.gv-toast-error {
    border-left-color: #EF4444;
}
.gv-toast-error .gv-toast-icon {
    background: #FEE2E2;
    color: #DC2626;
}
.gv-toast-error .gv-toast-progress-fill {
    background: #EF4444;
}

.gv-toast-warning {
    border-left-color: #F59E0B;
}
.gv-toast-warning .gv-toast-icon {
    background: #FEF3C7;
    color: #D97706;
}
.gv-toast-warning .gv-toast-progress-fill {
    background: #F59E0B;
}

.gv-toast-info {
    border-left-color: #2563EB;
}
.gv-toast-info .gv-toast-icon {
    background: #DBEAFE;
    color: #2563EB;
}
.gv-toast-info .gv-toast-progress-fill {
    background: #2563EB;
}

@media (max-width: 576px) {
    .gv-toast-container {
        top: 16px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: 100%;
    }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .gv-confirm-backdrop,
    .gv-confirm-dialog-wrapper,
    .gv-confirm-modal,
    .gv-toast-card {
        transition: none !important;
        animation: none !important;
    }
}
