/**
 * Dashboard Personnalisable - Styles
 */

/* Mode édition */
.dashboard-edit-mode {
    position: relative;
}

.dashboard-edit-mode::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.05);
    z-index: 1000;
    pointer-events: none;
}

.dashboard-edit-mode .dashboard-widgets-container {
    position: relative;
    z-index: 1001;
}

/* Container des widgets */
.dashboard-widgets-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

@media (min-width: 768px) {
    .dashboard-widgets-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .dashboard-widgets-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1400px) {
    .dashboard-widgets-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Widget individuel */
.dashboard-widget {
    position: relative;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-height: 200px;
    overflow: hidden;
}

.dashboard-widget:hover {
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.dashboard-edit-mode .dashboard-widget {
    cursor: move;
    border: 2px dashed transparent;
}

.dashboard-edit-mode .dashboard-widget:hover {
    border-color: var(--bs-primary);
}

.dashboard-edit-mode .dashboard-widget.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

/* En-tête du widget */
.dashboard-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.dashboard-widget-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #495057;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-widget-title i {
    color: var(--bs-primary);
}

.dashboard-widget-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.dashboard-widget-remove {
    display: none;
    color: #dc3545;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.dashboard-edit-mode .dashboard-widget-remove {
    display: block;
}

.dashboard-widget-remove:hover {
    background: #f8d7da;
    color: #721c24;
}

.dashboard-widget-resize {
    display: none;
    color: #6c757d;
    cursor: nwse-resize;
    font-size: 0.875rem;
}

.dashboard-edit-mode .dashboard-widget-resize {
    display: block;
}

/* Contenu du widget */
.dashboard-widget-content {
    padding: 1rem;
}

.dashboard-widget-content.loading {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tailles de widgets */
.dashboard-widget-size-small {
    grid-column: span 1;
}

.dashboard-widget-size-medium {
    grid-column: span 2;
}

.dashboard-widget-size-large {
    grid-column: span 3;
}

.dashboard-widget-size-full {
    grid-column: 1 / -1;
}

/* Bibliothèque de widgets */
.dashboard-widget-library {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.dashboard-widget-library.open {
    right: 0;
}

.dashboard-widget-library-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    background: var(--bs-primary);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dashboard-widget-library-title {
    font-weight: 600;
    margin: 0;
    font-size: 1.1rem;
}

.dashboard-widget-library-close {
    color: #fff;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background 0.2s;
}

.dashboard-widget-library-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.dashboard-widget-library-content {
    padding: 1rem;
}

.dashboard-widget-category {
    margin-bottom: 2rem;
}

.dashboard-widget-category-title {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.dashboard-widget-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: grab;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-widget-item:hover {
    background: #e9ecef;
    border-color: var(--bs-primary);
    transform: translateX(5px);
}

.dashboard-widget-item:active {
    cursor: grabbing;
}

.dashboard-widget-item-info {
    flex: 1;
}

.dashboard-widget-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #495057;
    margin: 0 0 0.25rem 0;
}

.dashboard-widget-item-description {
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0;
}

.dashboard-widget-item-icon {
    color: var(--bs-primary);
    font-size: 1.25rem;
}

.dashboard-widget-item-added {
    color: #28a745;
    font-size: 1rem;
}

/* Bouton personnaliser */
.dashboard-customize-btn {
    position: fixed !important;
    bottom: 2rem !important;
    right: 2rem !important;
    z-index: 9999 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.25) !important;
    border-radius: 2rem !important;
    min-width: 180px;
    height: 56px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0 1.5rem;
    border: none;
}

.dashboard-customize-btn i {
    font-size: 1.1rem;
}

.dashboard-customize-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.3) !important;
}

.dashboard-edit-mode .dashboard-customize-btn {
    background: var(--bs-danger) !important;
    color: #fff !important;
}

.dashboard-edit-mode .dashboard-customize-btn:hover {
    background: #dc3545 !important;
    color: #fff !important;
}

/* Responsive pour mobile */
@media (max-width: 767px) {
    .dashboard-customize-btn {
        bottom: 1rem !important;
        right: 1rem !important;
        min-width: auto;
        width: 56px;
        height: 56px;
        border-radius: 50% !important;
        padding: 0;
    }
    
    .dashboard-customize-btn .btn-text {
        display: none;
    }
}

/* Zone de drop */
.dashboard-drop-zone {
    min-height: 200px;
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    color: #6c757d;
    transition: all 0.3s;
    background: #f8f9fa;
}

.dashboard-drop-zone.drag-over {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
}

/* Animations */
@keyframes widgetFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-widget {
    animation: widgetFadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 767px) {
    .dashboard-widget-library {
        width: 100%;
        right: -100%;
    }
    
    .dashboard-widgets-container {
        grid-template-columns: 1fr;
    }
    
    .dashboard-widget-size-medium,
    .dashboard-widget-size-large,
    .dashboard-widget-size-full {
        grid-column: span 1;
    }
}

/* Placeholder pour widgets vides */
.dashboard-widget-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #6c757d;
    text-align: center;
    padding: 2rem;
}

.dashboard-widget-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.dashboard-widget-empty p {
    margin: 0;
    font-size: 0.875rem;
}

