/**
 * Loading States and Modern Toast Messages CSS
 * Works in both light and dark modes
 */

/* Toast Container */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

/* Toast Styles */
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    pointer-events: all;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid transparent;
}

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

.toast-hide {
    transform: translateX(100%);
    opacity: 0;
}

/* Toast Types - Light Mode */
.toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
}

.toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: #ef4444;
}

.toast-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-color: #f59e0b;
}

.toast-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #3b82f6;
}

/* Dark Mode Toast Styles */
.dark-mode .toast {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .toast-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: #059669;
}

.dark-mode .toast-error {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    border-color: #dc2626;
}

.dark-mode .toast-warning {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    border-color: #d97706;
}

.dark-mode .toast-info {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #2563eb;
}

/* Toast Icon */
.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

/* Toast Content */
.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

/* Toast Close Button */
.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

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

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

.loading-text {
    opacity: 0.9;
}

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

/* Form Validation Styles */
.field-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.dark-mode .field-error {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2) !important;
}

.field-error-message {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #ef4444;
    font-size: 13px;
    font-weight: 500;
    margin-top: 6px;
    animation: slideDown 0.2s ease-out;
}

.dark-mode .field-error-message {
    color: #f87171;
}

.field-error-message::before {
    content: '⚠';
    font-size: 14px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
    
    .loading-spinner {
        width: 14px;
        height: 14px;
        border-width: 1.5px;
    }
}

/* Button Loading State Variations */
.btn-loading.btn-primary {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: white !important;
}

.btn-loading.btn-success {
    background: #10b981 !important;
    border-color: #10b981 !important;
    color: white !important;
}

.btn-loading.btn-danger {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: white !important;
}

.btn-loading.btn-warning {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: white !important;
}

.btn-loading.btn-secondary {
    background: #6b7280 !important;
    border-color: #6b7280 !important;
    color: white !important;
}

/* Dark Mode Button Loading */
.dark-mode .btn-loading {
    opacity: 0.8;
}

.dark-mode .btn-loading.btn-primary {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

.dark-mode .btn-loading.btn-success {
    background: #059669 !important;
    border-color: #059669 !important;
}

.dark-mode .btn-loading.btn-danger {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

.dark-mode .btn-loading.btn-warning {
    background: #d97706 !important;
    border-color: #d97706 !important;
}

.dark-mode .btn-loading.btn-secondary {
    background: #4b5563 !important;
    border-color: #4b5563 !important;
}

/* Focus States for Validation */
.field-error:focus {
    outline: none;
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

.dark-mode .field-error:focus {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.3) !important;
}

/* Success State for Fields */
.field-success {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

.dark-mode .field-success {
    border-color: #059669 !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2) !important;
}

/* Progress Indicators */
.progress-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: 10000;
}

.progress-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.dark-mode .progress-spinner {
    border-top-color: #60a5fa;
    border-color: rgba(255, 255, 255, 0.1);
}
