/**
 * Error Handling Styles
 */

/* Global Error Container */
.global-error-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
}

/* Error Message Styles */
.error-message {
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
}

.error-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #dc3545;
}

.error-icon {
    font-size: 18px;
    margin-right: 10px;
    flex-shrink: 0;
}

.error-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

.error-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.error-close:hover {
    background-color: #f0f0f0;
}

/* Error Type Specific Styles */
.error-network .error-content {
    border-left-color: #fd7e14;
    background: #fff3cd;
}

.error-client .error-content {
    border-left-color: #dc3545;
    background: #f8d7da;
}

.error-server .error-content {
    border-left-color: #6f42c1;
    background: #e2d9f3;
}

.error-validation .error-content {
    border-left-color: #ffc107;
    background: #fff3cd;
}

.error-general .error-content {
    border-left-color: #6c757d;
    background: #f8f9fa;
}

/* Form Field Error Styles */
.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-group .error-message {
    display: none;
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    margin-bottom: 0;
    animation: none;
    box-shadow: none;
    border-radius: 0;
}

.form-group .error-message.show {
    display: block;
}

.form-group .error-message .error-content {
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
}

.form-group .error-message .error-icon {
    display: none;
}

.form-group .error-message .error-close {
    display: none;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: white;
    margin-top: 20px;
    text-align: center;
}

/* Button Loading States */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading .btn-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Retry Button */
.retry-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
    transition: background-color 0.2s;
}

.retry-btn:hover {
    background: #0056b3;
}

.retry-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Network Status Indicator */
.network-status {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    transition: all 0.3s ease;
}

.network-status.online {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.network-status.offline {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.network-status.reconnecting {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Form Validation Feedback */
.field-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

.field-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    animation: shake 0.5s ease-in-out;
}

/* Success Messages */
.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.success-message .success-icon {
    color: #28a745;
    margin-right: 10px;
    font-size: 18px;
}

/* Warning Messages */
.warning-message {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.warning-message .warning-icon {
    color: #ffc107;
    margin-right: 10px;
    font-size: 18px;
}

/* Info Messages */
.info-message {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.info-message .info-icon {
    color: #17a2b8;
    margin-right: 10px;
    font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .global-error-container {
        left: 10px;
        right: 10px;
        top: 10px;
        max-width: none;
    }

    .error-content {
        padding: 10px 12px;
    }

    .error-text {
        font-size: 13px;
    }

    .network-status {
        bottom: 10px;
        left: 10px;
        font-size: 11px;
        padding: 6px 10px;
    }
}