/* 
 * Common Utilities and Reusable Components
 * Wisdom Brains Abacus Academy
 * Removes duplicate styles and provides common utilities
 */

/* Animation Utilities */
.fade-in {
    animation: fadeIn 0.6s ease-in-out;
}

.slide-up {
    animation: slideUp 0.8s ease-out;
}

.scale-in {
    animation: scaleIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes scaleIn {
    from { 
        opacity: 0; 
        transform: scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

/* Staggered Animation Delays */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/* Card Components */
.card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-3d {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.card-3d:hover {
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Gradient Backgrounds */
.bg-gradient-primary {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 50%, #312e81 100%);
}

.bg-gradient-secondary {
    background: linear-gradient(135deg, #ea580c 0%, #dc2626 50%, #b91c1c 100%);
}

.bg-gradient-light {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.bg-pattern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.1) 75%), 
        linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.1) 75%);
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
    opacity: 0.3;
    pointer-events: none;
}

/* Icon Styles */
.icon-gradient {
    background: linear-gradient(135deg, #ea580c, #f97316);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 8px rgba(234, 88, 12, 0.3);
}

.icon-lg { font-size: 4rem; }
.icon-md { font-size: 2.5rem; }
.icon-sm { font-size: 1.5rem; }

/* Grid Systems */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.grid-auto-fill {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Flex Utilities */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-start {
    display: flex;
    align-items: flex-start;
}

/* Text Utilities */
.text-gradient {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.text-shadow-lg {
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Button System - Consolidated from all files */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-family: inherit;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

.btn-primary {
    background: linear-gradient(135deg, #1e40af, #1e3a8a);
    color: white;
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 64, 175, 0.4);
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.btn-secondary {
    background: white;
    color: #1e40af;
    border: 2px solid #1e40af;
}

.btn-secondary:hover:not(:disabled) {
    background: #1e40af;
    color: white;
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: white;
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.3);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(22, 163, 74, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid currentColor;
}

.btn-outline:hover:not(:disabled) {
    background: currentColor;
    color: white;
}

.btn-lg {
    padding: 1.25rem 2.5rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
}

.btn-xs {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading state for buttons */
.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: btn-spin 0.75s linear infinite;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* Status Indicators */
.status-success {
    color: #059669;
    background-color: #f0fdf4;
    border-color: #bbf7d0;
}

.status-error {
    color: #dc2626;
    background-color: #fef2f2;
    border-color: #fecaca;
}

.status-warning {
    color: #d97706;
    background-color: #fffbeb;
    border-color: #fed7aa;
}

.status-info {
    color: #2563eb;
    background-color: #eff6ff;
    border-color: #bfdbfe;
}

/* Media Queries for Common Breakpoints */
@media (max-width: 640px) {
    .grid-auto-fit {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .card {
        border-radius: 0.75rem;
        padding: 1rem;
    }
    
    .icon-lg { font-size: 3rem; }
    .icon-md { font-size: 2rem; }
}

@media (max-width: 768px) {
    .grid-auto-fit {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
    
    .bg-gradient-primary,
    .bg-gradient-secondary {
        background: #1e40af !important;
        color: white !important;
    }
}