﻿/* =============================================================================
   XSYSTEM LIBRARY COMPONENTS - MODAL & TOAST STYLES
   ============================================================================= */

/* Variables - Can be overridden by parent app */
:root {
    --xsystem-primary: #6366f1;
    --xsystem-primary-hover: #4f46e5;
    --xsystem-success: #10b981;
    --xsystem-danger: #ef4444;
    --xsystem-warning: #f59e0b;
    --xsystem-info: #06b6d4;
    --xsystem-text: #1e293b;
    --xsystem-text-secondary: #64748b;
    --xsystem-text-muted: #94a3b8;
    --xsystem-border: #e2e8f0;
    --xsystem-radius: 0.5rem;
    --xsystem-radius-lg: 0.75rem;
    --xsystem-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --xsystem-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
}

/* =============================================================================
   MODAL BODY SCROLL LOCK
   ============================================================================= */
body.xsystem-modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* =============================================================================
   MODAL BACKDROP & DIALOG
   ============================================================================= */
.xsystem-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1055;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: xsystem-fadeIn 0.15s ease;
}

.xsystem-modal-dialog {
    position: relative;
    width: 100%;
    margin: auto;
    pointer-events: auto;
    background: white;
    border-radius: var(--xsystem-radius-lg);
    box-shadow: var(--xsystem-shadow-lg);
    animation: xsystem-slideUp 0.2s ease;
}

.xsystem-modal-sm {
    max-width: 400px;
}

.xsystem-modal-lg {
    max-width: 800px;
}

.xsystem-modal-xl {
    max-width: 1200px;
}

/* =============================================================================
   CONFIRM MODAL
   ============================================================================= */
.xsystem-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1060;
    animation: xsystem-fadeIn 0.15s ease;
}

.xsystem-confirm-modal {
    background: white;
    border-radius: var(--xsystem-radius-lg);
    box-shadow: var(--xsystem-shadow-lg);
    min-width: 320px;
    max-width: 420px;
    animation: xsystem-slideUp 0.2s ease;
}

.xsystem-confirm-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--xsystem-border);
}

.xsystem-confirm-header i {
    font-size: 1.5rem;
}

.xsystem-confirm-header h5 {
    margin: 0;
    font-weight: 600;
    color: var(--xsystem-text);
}

.xsystem-confirm-body {
    padding: 1.25rem;
}

.xsystem-confirm-body p {
    margin: 0;
    color: var(--xsystem-text-secondary);
}

.xsystem-confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--xsystem-border);
    background: #f8fafc;
    border-radius: 0 0 var(--xsystem-radius-lg) var(--xsystem-radius-lg);
}

/* =============================================================================
   TOAST NOTIFICATION
   ============================================================================= */
.xsystem-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1070;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
    pointer-events: none;
}

.xsystem-toast-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: white;
    border-radius: var(--xsystem-radius);
    box-shadow: var(--xsystem-shadow);
    animation: xsystem-slideInRight 0.2s ease;
    pointer-events: auto;
}

.xsystem-toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.xsystem-toast-content {
    flex: 1;
    min-width: 0;
}

.xsystem-toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--xsystem-text);
}

.xsystem-toast-message {
    font-size: 0.8125rem;
    color: var(--xsystem-text-secondary);
    word-wrap: break-word;
}

.xsystem-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--xsystem-text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    transition: color 0.15s;
    line-height: 1;
}

.xsystem-toast-close:hover {
    color: var(--xsystem-text);
}

/* Toast type colors */
.xsystem-toast-success .xsystem-toast-icon {
    color: var(--xsystem-success);
}

.xsystem-toast-error .xsystem-toast-icon {
    color: var(--xsystem-danger);
}

.xsystem-toast-warning .xsystem-toast-icon {
    color: var(--xsystem-warning);
}

.xsystem-toast-info .xsystem-toast-icon {
    color: var(--xsystem-info);
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */
@keyframes xsystem-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes xsystem-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes xsystem-slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 768px) {
    .xsystem-modal-dialog,
    .xsystem-modal-sm,
    .xsystem-modal-lg,
    .xsystem-modal-xl {
        max-width: calc(100vw - 2rem);
    }

    .xsystem-toast-container {
        left: 1rem;
        right: 1rem;
        max-width: calc(100vw - 2rem);
    }

    .xsystem-confirm-modal {
        min-width: auto;
        max-width: calc(100vw - 2rem);
    }
}
