/**
 * 🎨 Common Utilities CSS
 * Shared utility classes for Frontend & Marketer Dashboard
 */

/* ============================================
   Loading States
============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   Stat Cards
============================================ */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-card-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-card-icon.green { background: #dcfce7; color: #16a34a; }
.stat-card-icon.blue { background: #dbeafe; color: #3b82f6; }
.stat-card-icon.orange { background: #fed7aa; color: #ea580c; }
.stat-card-icon.cyan { background: #cffafe; color: #0891b2; }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.stat-change {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    display: inline-block;
    margin-top: 0.5rem;
}

.stat-change.positive {
    background: #dcfce7;
    color: #16a34a;
}

.stat-change.negative {
    background: #fee2e2;
    color: #dc2626;
}

/* ============================================
   Notifications
============================================ */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

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

.notification.success {
    border-right: 4px solid #16a34a;
}

.notification.error {
    border-right: 4px solid #dc2626;
}

.notification.warning {
    border-right: 4px solid #ea580c;
}

.notification.info {
    border-right: 4px solid #3b82f6;
}

/* ============================================
   Empty States
============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.empty-state-description {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ============================================
   Utility Classes
============================================ */
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-center { text-align: center; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

/* ============================================
   Responsive Grid
============================================ */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

/* ============================================
   Transitions
============================================ */
.transition-all {
    transition: all 0.3s ease;
}

.hover\:shadow-xl:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ============================================
   ✅ FIX: SVG Icon Size Guard
   منع الأيقونات من أخذ حجم كبير افتراضي بدون Tailwind
   يُطبّق فقط على الأيقونات inline (SVG التي بتظهر داخل النص)
============================================ */

/* x-icon component default size — مكافئ لـ w-5 h-5 */
svg.inline-block {
    width:  1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* ✅ FIX CRITICAL: svg.icon — مستخدم في home.blade.php وكل الـ views
   بدون هذا الـ selector الأيقونات بتاخد حجم 300x150px (browser default)
   يُطبّق على كل SVG بـ class="icon" في الموقع */
svg.icon {
    width:  1.25rem !important;
    height: 1.25rem !important;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Floating Action Buttons - تفرض الحجم داخل المربع */
.fab-icon svg {
    width:  22px !important;
    height: 22px !important;
    flex-shrink: 0;
}

/* Font Awesome icons in nav — توحيد الحجم */
nav .fa-phone,
nav .fa-envelope,
nav .fa-user {
    font-size: 0.875rem;
}

nav .fa-shopping-cart,
nav .fa-heart,
nav .fa-search {
    font-size: 1rem;
}

/* SVG icons without explicit size in navigation */
nav svg:not([width]):not([height]):not(.inline-block) {
    width:  1.25rem;
    height: 1.25rem;
    display: inline-block;
    vertical-align: middle;
}
