/* ==========================================
   ⚠️ PORTAL ERROR STATES SYSTEM - FAZA C
   Comprehensive error handling & validation states
   ========================================== */

/* ==========================================
   🎨 ERROR STATE VARIANTS
   ========================================== */

/* Inline error message */
.error-message,
.field-error {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    margin-top: var(--space-2);
    font-size: var(--fs-sm);
    color: var(--error-text);
    background: var(--error-lighter);
    border: 1px solid var(--error-border);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 (deprecated fix) */
    animation: slideDown 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.error-message::before,
.field-error::before {
    content: "⚠️";
    flex-shrink: 0;
}

/* Success message */
.success-message,
.field-success {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    margin-top: var(--space-2);
    font-size: var(--fs-sm);
    color: var(--success-text);
    background: var(--success-lighter);
    border: 1px solid var(--success-border);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 (deprecated fix) */
    animation: slideDown 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.success-message::before,
.field-success::before {
    content: "✓";
    flex-shrink: 0;
}

/* Warning message */
.warning-message {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    margin-top: var(--space-2);
    font-size: var(--fs-sm);
    color: var(--warning-text);
    background: var(--warning-lighter);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 (deprecated fix) */
    animation: slideDown 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.warning-message::before {
    content: "⚡";
    flex-shrink: 0;
}

/* Info message */
.info-message {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    margin-top: var(--space-2);
    font-size: var(--fs-sm);
    color: var(--info-text);
    background: var(--info-lighter);
    border: 1px solid var(--info-border);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 (deprecated fix) */
    animation: slideDown 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.info-message::before {
    content: "ℹ️";
    flex-shrink: 0;
}

/* ==========================================
   📝 FORM INPUT ERROR STATES
   ========================================== */

/* Input error state */
input.error,
textarea.error,
select.error,
.input-error {
    border-color: var(--error-color) !important;
    background-color: var(--error-lighter) !important;
    box-shadow: 0 0 0 3px var(--error-focus) !important;
}

input.error:focus,
textarea.error:focus,
select.error:focus,
.input-error:focus {
    outline: none;
    border-color: var(--error-dark) !important;
    box-shadow: 0 0 0 3px var(--error-focus) !important;
}

/* Input success state */
input.success,
textarea.success,
select.success,
.input-success {
    border-color: var(--success-color) !important;
    background-color: var(--success-lighter) !important;
    box-shadow: 0 0 0 3px var(--success-focus) !important;
}

input.success:focus,
textarea.success:focus,
select.success:focus,
.input-success:focus {
    outline: none;
    border-color: var(--success-dark) !important;
    box-shadow: 0 0 0 3px var(--success-focus) !important;
}

/* Input warning state */
input.warning,
textarea.warning,
select.warning,
.input-warning {
    border-color: var(--warning-color) !important;
    background-color: var(--warning-lighter) !important;
    box-shadow: 0 0 0 3px var(--warning-focus) !important;
}

/* ==========================================
   🎯 ERROR CONTAINERS
   ========================================== */

/* Error box - dla większych komunikatów */
.error-box {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    margin: var(--space-4) 0;
    background: var(--error-lighter);
    border: 1px solid var(--error-border);
    border-left: 4px solid var(--error-color);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
    animation: slideDown 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.error-box-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--error-dark);
}

.error-box-title::before {
    content: "⚠️";
    font-size: var(--fs-lg);
}

.error-box-message {
    font-size: var(--fs-sm);
    color: var(--error-text);
    line-height: var(--lh-normal);
}

/* Success box */
.success-box {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    margin: var(--space-4) 0;
    background: var(--success-lighter);
    border: 1px solid var(--success-border);
    border-left: 4px solid var(--success-color);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
    animation: slideDown 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.success-box-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--success-dark);
}

.success-box-title::before {
    content: "✓";
    font-size: var(--fs-lg);
}

/* Warning box */
.warning-box {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    margin: var(--space-4) 0;
    background: var(--warning-lighter);
    border: 1px solid var(--warning-border);
    border-left: 4px solid var(--warning-color);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
    animation: slideDown 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.warning-box-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--warning-dark);
}

.warning-box-title::before {
    content: "⚡";
    font-size: var(--fs-lg);
}

/* ==========================================
   🎭 ERROR BADGE / TAG
   ========================================== */

.error-badge,
.badge-error {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--error-text);
    background: var(--error-light);
    border: 1px solid var(--error-border);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 (deprecated fix) */
}

.success-badge,
.badge-success {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--success-text);
    background: var(--success-light);
    border: 1px solid var(--success-border);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 (deprecated fix) */
}

.warning-badge,
.badge-warning {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--warning-text);
    background: var(--warning-light);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 (deprecated fix) */
}

.info-badge,
.badge-info {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--info-text);
    background: var(--info-light);
    border: 1px solid var(--info-border);
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 (deprecated fix) */
}

/* ==========================================
   💥 TOAST NOTIFICATIONS - EXTENDED
   ========================================== */

/* Enhanced toast container */
#portal-toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 400px;
    pointer-events: none;
}

.portal-toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-button); /* 8px - Shape & Sizing System v4.0 (deprecated fix) */
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastSlideIn 300ms cubic-bezier(0.4, 0, 0.2, 1);
    transition: var(--transition-base);
}

.portal-toast.removing {
    animation: toastSlideOut 200ms cubic-bezier(0.4, 0, 1, 1);
}

.portal-toast-icon {
    flex-shrink: 0;
    font-size: var(--fs-lg);
}

.portal-toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.portal-toast-title {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.portal-toast-message {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

.portal-toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm); /* 4px - Shape & Sizing System v4.0 (deprecated fix) */
    transition: var(--transition-colors);
}

.portal-toast-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Toast variants */
.portal-toast.error {
    border-left: 4px solid var(--error-color);
}

.portal-toast.success {
    border-left: 4px solid var(--success-color);
}

.portal-toast.warning {
    border-left: 4px solid var(--warning-color);
}

.portal-toast.info {
    border-left: 4px solid var(--info-color);
}

/* ==========================================
   🎬 ANIMATIONS
   ========================================== */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ==========================================
   📱 RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    #portal-toast-container {
        top: var(--space-3);
        right: var(--space-3);
        left: var(--space-3);
        max-width: none;
    }
    
    .error-box,
    .success-box,
    .warning-box {
        padding: var(--space-3);
        margin: var(--space-3) 0;
    }
}


