/**
 * World-Class Error Styling for EnigmAPI
 * Matches glassmorphism design system with beautiful, professional error displays
 */

/* Error Container */
.enigma-error-container {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
}

/* Error Element */
.enigma-error {
    position: fixed;
    min-width: 400px;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.15),
        0 2px 8px 0 rgba(31, 38, 135, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    overflow: hidden;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 16px;
}

.enigma-error.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Positioning */
.enigma-error.top-right {
    top: 20px;
    right: 20px;
}

.enigma-error.top-left {
    top: 20px;
    left: 20px;
}

.enigma-error.bottom-right {
    bottom: 20px;
    right: 20px;
}

.enigma-error.bottom-left {
    bottom: 20px;
    left: 20px;
}

.enigma-error.top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px) scale(0.95);
}

.enigma-error.top-center.show {
    transform: translateX(-50%) translateY(0) scale(1);
}

/* Error Header */
.error-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.error-icon {
    font-size: 24px;
    margin-right: 12px;
    line-height: 1;
}

.error-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.error-title strong {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
}

.error-code {
    font-size: 11px;
    font-weight: 500;
    color: #666;
    font-family: 'Monaco', 'Courier New', monospace;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.error-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    margin-left: 8px;
}

.error-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

/* Error Body */
.error-body {
    padding: 20px;
}

.error-message {
    color: #333;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 16px 0;
    font-weight: 500;
}

/* Error Details */
.error-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.error-requirements,
.error-results,
.error-minimums,
.error-validation {
    margin-bottom: 16px;
}

.error-requirements:last-child,
.error-results:last-child,
.error-minimums:last-child,
.error-validation:last-child {
    margin-bottom: 0;
}

.error-requirements strong,
.error-results strong,
.error-minimums strong,
.error-validation strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.error-requirements ul,
.error-results ul,
.error-minimums ul,
.error-validation ul {
    margin: 0;
    padding-left: 20px;
    list-style: disc;
}

.error-requirements li,
.error-results li,
.error-minimums li,
.error-validation li {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 4px;
}

/* Error Action */
.error-action {
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
    border-left: 3px solid #3b82f6;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
}

.error-action strong {
    color: #3b82f6;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

/* Documentation Link */
.error-docs {
    margin-top: 16px;
    text-align: right;
}

.error-docs a {
    display: inline-block;
    font-size: 12px;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    background: rgba(59, 130, 246, 0.1);
}

.error-docs a:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

/* Severity Colors */
.enigma-error.error-danger {
    border-left: 4px solid #ef4444;
}

.enigma-error.error-danger .error-header {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
}

.enigma-error.error-warning {
    border-left: 4px solid #f59e0b;
}

.enigma-error.error-warning .error-header {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
}

.enigma-error.error-info {
    border-left: 4px solid #3b82f6;
}

.enigma-error.error-info .error-header {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
}

.enigma-error.error-success {
    border-left: 4px solid #10b981;
}

.enigma-error.error-success .error-header {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .enigma-error {
        min-width: auto;
        max-width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px !important;
        transform: none;
    }

    .enigma-error.top-center {
        transform: translateY(-20px) scale(0.95);
    }

    .enigma-error.top-center.show {
        transform: translateY(0) scale(1);
    }

    .error-header {
        padding: 14px 16px;
    }

    .error-body {
        padding: 16px;
    }

    .error-icon {
        font-size: 20px;
        margin-right: 10px;
    }

    .error-title strong {
        font-size: 14px;
    }

    .error-code {
        font-size: 10px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .enigma-error {
        background: rgba(26, 26, 26, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .error-title strong {
        color: #fff;
    }

    .error-code {
        color: #999;
    }

    .error-message {
        color: #e5e5e5;
    }

    .error-requirements li,
    .error-results li,
    .error-minimums li,
    .error-validation li {
        color: #ccc;
    }

    .error-requirements strong,
    .error-results strong,
    .error-minimums strong,
    .error-validation strong {
        color: #bbb;
    }

    .error-close {
        color: #666;
    }

    .error-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }
}

/* Animation Keyframes */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInTop {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stacking Multiple Errors */
.enigma-error-container .enigma-error:not(:first-child) {
    margin-top: 16px;
}

/* Loading State for Error Container */
.enigma-error-container.loading::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
