/* Custom styles for FLUXI */

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

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

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

/* Loading spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #4f46e5;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Toast notifications */
.toast {
    animation: slideIn 0.3s ease-in-out;
}

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

/* Button effects */
.btn-primary {
    background-color: #4f46e5;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
    cursor: pointer;
    border: none;
}

.btn-primary:hover {
    background-color: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: #e5e7eb;
    color: #374151;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
    cursor: pointer;
    border: none;
}

.btn-secondary:hover {
    background-color: #d1d5db;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
    cursor: pointer;
    border: none;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

/* Card styles */
.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
}

/* Form styles */
.form-input {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.5;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* Status badges */
.badge-success {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: #dbeafe;
    color: #1e40af;
}

/* ==================== RESPONSIVE DESIGN ==================== */

/* Mobile First - Base styles are for mobile */

/* Ensure viewport is set correctly */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Mobile: Stack everything vertically, full width */
@media (max-width: 768px) {
    /* Container adjustments */
    .flex-1 {
        min-width: 0 !important;
        width: 100% !important;
    }
    
    .flex-1.lg\:ml-64 {
        margin-left: 0 !important;
        padding: 1rem !important;
    }
    
    /* Fix overflow issues */
    body, html {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .flex.min-h-screen {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* Headers */
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    /* Hero cards - reduce padding */
    .bg-gradient-to-r {
        padding: 1.5rem !important;
    }
    
    /* Grid columns - force single column */
    .grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Tables - make them scrollable */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Forms - full width inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        width: 100%;
        max-width: 100%;
    }
    
    /* Buttons - full width on mobile */
    .mobile-full-width {
        width: 100%;
        display: block;
    }
    
    /* Hide text, show icons only on small buttons */
    .btn-mobile-icon-only span {
        display: none;
    }
    
    /* Cards - reduce spacing */
    .card,
    .bg-white.rounded-2xl {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Stats/Numbers - smaller on mobile */
    .text-5xl {
        font-size: 2.5rem !important;
    }
    
    /* Flex items - wrap on mobile */
    .flex {
        flex-wrap: wrap;
    }
    
    .flex.gap-3,
    .flex.gap-4,
    .flex.gap-6 {
        gap: 0.75rem !important;
    }
    
    /* QR Code container */
    .qr-code-container {
        max-width: 100%;
        padding: 1rem;
    }
    
    /* Status badges - smaller text */
    .badge-success,
    .badge-warning,
    .badge-danger,
    .badge-info {
        font-size: 0.75rem !important;
        padding: 0.125rem 0.5rem !important;
    }
    
    /* Modals - full screen on mobile */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 1rem auto !important;
    }
    
    /* Product cards */
    .product-card {
        width: 100% !important;
    }
    
    /* Max width containers */
    .max-w-5xl,
    .max-w-6xl,
    .max-w-7xl {
        max-width: 100% !important;
        padding: 0 1rem;
    }
    
    /* Overflow scroll for wide content */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .flex-1.lg\:ml-64 {
        margin-left: 16rem !important;
        padding: 1.5rem !important;
    }
    
    h1 {
        font-size: 2rem !important;
    }
    
    .bg-gradient-to-r {
        padding: 2rem !important;
    }
}

/* Hide sidebar on mobile by default */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 30;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* Touch-friendly tap targets */
@media (max-width: 768px) {
    button,
    a,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Larger touch targets for icons */
    .icon-button {
        padding: 0.75rem !important;
    }
}

/* Landscape mobile phones */
@media (max-width: 896px) and (orientation: landscape) {
    .hero-card {
        padding: 1rem !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
}

/* Line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Print styles */
@media print {
    .sidebar,
    .navbar,
    button,
    .no-print {
        display: none !important;
    }
    
    .flex-1.lg\:ml-64 {
        margin-left: 0 !important;
    }
}
