/**
 * Shared Components CSS for FarmFirst Platform
 * Unified styles for loaders, animations, and shared UI components
 */

/* ========================================
   LOADER OVERLAY STYLES
   ======================================== */

.loader-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100vh !important;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(8px);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    margin: 0 !important;
    padding: 0 !important;
}

.loader-overlay.show {
    opacity: 1 !important;
}

.loader-overlay.hide {
    opacity: 0 !important;
}

.loader-content {
    text-align: center;
    padding: 3rem 2.5rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    min-width: 320px;
    max-width: 400px;
    position: relative;
    z-index: 1000000;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    border: 5px solid #f3f3f3;
    border-top-color: var(--loader-color, #2f7a3d);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Blue theme for sellers */
.loader-overlay.theme-blue .loader-spinner {
    border-top-color: #1877f2;
}

/* Green theme for farmers/admin */
.loader-overlay.theme-green .loader-spinner {
    border-top-color: #2f7a3d;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.loader-spinner i.fa-check-circle {
    animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: inline-block;
}

.loader-message {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    transition: color 0.3s ease;
}

/* Success state styling */
.loader-overlay.success .loader-content {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.loader-overlay.success .loader-message {
    color: #10b981;
    font-weight: 700;
}

/* ========================================
   PAGE ENTRY ANIMATIONS
   ======================================== */

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-enter-animation {
    animation: fadeSlideIn 0.5s ease-out;
}

/* Apply to specific elements that need delayed entry */
.page-enter-animation-delay-1 {
    animation: fadeSlideIn 0.5s ease-out 0.1s both;
}

.page-enter-animation-delay-2 {
    animation: fadeSlideIn 0.5s ease-out 0.2s both;
}

.page-enter-animation-delay-3 {
    animation: fadeSlideIn 0.5s ease-out 0.3s both;
}

/* ========================================
   SWEETALERT2 CUSTOM STYLES
   ======================================== */

/* Common toast styles */
.swal2-toast {
    font-family: 'Inter', sans-serif;
    border-radius: 12px;
    padding: 1rem;
}

.swal2-popup {
    font-family: 'Inter', sans-serif;
    border-radius: 16px;
}

/* Success toast - green theme */
.swal2-toast.swal2-success {
    background-color: #22c55e;
    border-left: 4px solid #16a34a;
}

/* Error toast - red theme */
.swal2-toast.swal2-error {
    background-color: #ef4444;
    border-left: 4px solid #dc2626;
}

/* Warning toast - amber theme */
.swal2-toast.swal2-warning {
    background-color: #f59e0b;
    border-left: 4px solid #d97706;
}

/* Info toast - blue theme */
.swal2-toast.swal2-info {
    background-color: #3b82f6;
    border-left: 4px solid #2563eb;
}

/* Delete confirmation modal */
.swal2-popup.delete-confirmation {
    padding: 2rem;
}

.swal2-html-container.delete-confirmation-text {
    font-size: 1.1rem;
    color: #666;
}

/* ========================================
   BUTTON ANIMATIONS
   ======================================== */

.btn-animate {
    transition: all 0.3s ease;
}

.btn-animate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.btn-animate:active {
    transform: translateY(0);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .loader-content {
        padding: 2rem 1.5rem;
        min-width: 240px;
    }
    
    .loader-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
    
    .loader-message {
        font-size: 1rem;
    }
    
    .swal2-popup {
        width: 90% !important;
        padding: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .loader-content {
        padding: 1.5rem;
        min-width: 200px;
    }
    
    .loader-spinner {
        width: 40px;
        height: 40px;
        margin-bottom: 1rem;
    }
    
    .loader-message {
        font-size: 0.9rem;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Prevent layout shift during animations */
.animating * {
    pointer-events: none;
}

