/* assets/styles/app.css */

/* Tailwind CSS directives */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Custom styles */
@layer base {
    body {
        @apply bg-gray-50 font-sans antialiased;
    }

    h1 {
        @apply text-4xl font-bold;
    }

    h2 {
        @apply text-2xl font-semibold;
    }

    h3 {
        @apply text-xl font-semibold;
    }

    /* Scrollbar personnalisée */
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    ::-webkit-scrollbar-track {
        @apply bg-gray-100 rounded;
    }

    ::-webkit-scrollbar-thumb {
        @apply bg-gray-400 rounded hover:bg-gray-500;
    }
}

@layer components {
    .btn-primary {
        @apply bg-primary-600 text-white px-4 py-2 rounded-lg hover:bg-primary-700 transition duration-200 disabled:opacity-50 disabled:cursor-not-allowed;
    }

    .btn-secondary {
        @apply bg-gray-200 text-gray-800 px-4 py-2 rounded-lg hover:bg-gray-300 transition duration-200 disabled:opacity-50 disabled:cursor-not-allowed;
    }

    .btn-danger {
        @apply bg-red-600 text-white px-4 py-2 rounded-lg hover:bg-red-700 transition duration-200 disabled:opacity-50 disabled:cursor-not-allowed;
    }

    .btn-outline {
        @apply border-2 border-primary-600 text-primary-600 px-4 py-2 rounded-lg hover:bg-primary-600 hover:text-white transition duration-200;
    }

    .card {
        @apply bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition duration-300;
    }

    .input {
        @apply w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed;
    }

    .label {
        @apply block text-sm font-medium text-gray-700 mb-1;
    }

    .alert-success {
        @apply bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded;
    }

    .alert-error {
        @apply bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded;
    }

    .alert-warning {
        @apply bg-yellow-100 border border-yellow-400 text-yellow-700 px-4 py-3 rounded;
    }

    .alert-info {
        @apply bg-blue-100 border border-blue-400 text-blue-700 px-4 py-3 rounded;
    }

    /* Badges */
    .badge {
        @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
    }

    .badge-success {
        @apply bg-green-100 text-green-800;
    }

    .badge-danger {
        @apply bg-red-100 text-red-800;
    }

    .badge-warning {
        @apply bg-yellow-100 text-yellow-800;
    }

    .badge-info {
        @apply bg-blue-100 text-blue-800;
    }

    /* Progress bar */
    .progress-bar {
        @apply fixed top-0 left-0 h-1 bg-primary-600 transition-all duration-300 z-50;
    }
}

@layer utilities {
    .line-clamp-2 {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

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

    .animate-slide-in-right {
        animation: slideInRight 0.3s ease-out;
    }

    .animate-fade-in {
        animation: fadeIn 0.5s ease-in;
    }

    .animate-pulse-slow {
        animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }

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

        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    @keyframes pulse {

        0%,
        100% {
            opacity: 1;
        }

        50% {
            opacity: 0.5;
        }
    }
}

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

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Product card hover effects */
.product-card:hover .product-image {
    transform: scale(1.1);
}

.product-image {
    transition: transform 0.5s ease;
}

/* Rating stars */
.rating-star {
    @apply text-yellow-400;
}

.rating-star-empty {
    @apply text-gray-300;
}

/* Responsive tables */
.table-responsive {
    @apply overflow-x-auto;
}

.table {
    @apply min-w-full divide-y divide-gray-200;
}

.table th {
    @apply px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider bg-gray-50;
}

.table td {
    @apply px-6 py-4 whitespace-nowrap text-sm text-gray-900;
}

/* Modal styles */
.modal {
    @apply fixed inset-0 z-50 hidden items-center justify-center;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
    @apply flex;
}

.modal-content {
    @apply bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-y-auto;
}

.modal-header {
    @apply px-6 py-4 border-b border-gray-200;
}

.modal-body {
    @apply px-6 py-4;
}

.modal-footer {
    @apply px-6 py-4 border-t border-gray-200 flex justify-end space-x-3;
}

/* Toast notifications */
.toast {
    @apply fixed top-20 right-4 z-50 px-4 py-3 rounded-lg shadow-lg text-white min-w-[200px];
    animation: slideInRight 0.3s ease-out;
}

.toast-success {
    @apply bg-green-500;
}

.toast-error {
    @apply bg-red-500;
}

.toast-info {
    @apply bg-blue-500;
}

.toast-warning {
    @apply bg-yellow-500;
}

/* Custom select */
.custom-select {
    @apply appearance-none bg-white border border-gray-300 rounded-lg px-3 py-2 pr-8;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

/* Pagination */
.pagination {
    @apply flex space-x-1;
}

.pagination-item {
    @apply px-3 py-1 border rounded hover:bg-gray-100 transition;
}

.pagination-item.active {
    @apply bg-primary-600 text-white border-primary-600;
}

.pagination-item.disabled {
    @apply opacity-50 cursor-not-allowed;
}

/* Dashboard cards */
.dashboard-card {
    @apply bg-white rounded-lg shadow p-6;
}

.dashboard-card-title {
    @apply text-gray-500 text-sm mb-2;
}

.dashboard-card-value {
    @apply text-2xl font-bold text-gray-800;
}

.dashboard-card-icon {
    @apply w-12 h-12 rounded-full flex items-center justify-center;
}

/* Form errors */
.form-error {
    @apply text-red-600 text-sm mt-1;
}

.form-error-list {
    @apply bg-red-50 border border-red-200 text-red-700 px-4 py-2 rounded mb-4;
}

/* Skeleton loading */
.skeleton {
    @apply bg-gray-200 animate-pulse rounded;
}

.skeleton-text {
    @apply h-4 bg-gray-200 rounded;
}

.skeleton-image {
    @apply bg-gray-200 rounded;
}