﻿/* wwwroot/css/user-modules-manager.css */
/* Gestione Moduli Utente con Drag & Drop */

/* ============================================
   MODAL OVERLAY
   ============================================ */
.um-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: umFadeIn 0.2s ease;
}

.um-modal {
    background: #fff;
    border-radius: 16px;
    width: 95%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: umSlideUp 0.3s ease;
}

/* ============================================
   HEADER
   ============================================ */
.um-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.um-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

    .um-header-left i {
        font-size: 1.4rem;
    }

    .um-header-left h5 {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 400;
    }

.um-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.um-module-count {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.um-close-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

    .um-close-btn:hover {
        background: rgba(255,255,255,0.3);
    }

/* ============================================
   TOOLBAR
   ============================================ */
.um-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 8px;
}

.um-toolbar-left {
    flex: 1;
    min-width: 200px;
}

.um-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.um-search {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

    .um-search:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
    }

/* ============================================
   BUTTONS
   ============================================ */
.um-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.um-btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.um-btn-primary {
    background: #3b82f6;
    color: white;
}

    .um-btn-primary:hover {
        background: #2563eb;
    }

.um-btn-success {
    background: #10b981;
    color: white;
}

    .um-btn-success:hover {
        background: #059669;
    }

.um-btn-danger {
    background: #ef4444;
    color: white;
}

    .um-btn-danger:hover {
        background: #dc2626;
    }

.um-btn-info {
    background: #6366f1;
    color: white;
}

    .um-btn-info:hover {
        background: #4f46e5;
    }

.um-btn-icon {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: transparent;
}

.um-btn-add {
    color: #10b981;
}

    .um-btn-add:hover {
        background: #d1fae5;
    }

.um-btn-edit {
    color: #6366f1;
}

    .um-btn-edit:hover {
        background: #e0e7ff;
    }

.um-btn-remove {
    color: #ef4444;
}

    .um-btn-remove:hover {
        background: #fee2e2;
    }

.um-select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.8rem;
    max-width: 180px;
}

.um-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #4b5563;
    cursor: pointer;
}

    .um-toggle input {
        accent-color: #3b82f6;
    }

.um-copy-group {
    display: flex;
    gap: 4px;
}

/* ============================================
   CONTENT COLUMNS
   ============================================ */
.um-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

.um-column {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

    .um-column:first-child {
        border-right: 1px solid #e5e7eb;
    }

.um-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.um-badge {
    background: #e5e7eb;
    color: #4b5563;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.um-badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.um-drag-hint {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 400;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 4px;
}

.um-module-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

    .um-module-list::-webkit-scrollbar {
        width: 6px;
    }

    .um-module-list::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 3px;
    }

/* ============================================
   MODULE CARDS
   ============================================ */
.um-module-card {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: white;
    transition: all 0.2s;
    gap: 8px;
}

    .um-module-card:hover {
        border-color: #93c5fd;
        box-shadow: 0 2px 8px rgba(59,130,246,0.08);
    }

    .um-module-card.um-assigned {
        border-left: 3px solid #3b82f6;
    }

.um-module-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.um-module-icon {
    font-size: 1.2rem;
    color: #6366f1;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.um-module-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.um-module-code {
    font-size: 0.7rem;
    color: #9ca3af;
}

.um-module-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

/* ============================================
   DRAG HANDLE & DRAG STATES
   ============================================ */
.um-drag-handle {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: grab;
    color: #9ca3af;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
    user-select: none;
}

    .um-drag-handle:hover {
        color: #4b5563;
        background: #f3f4f6;
    }

    .um-drag-handle:active {
        cursor: grabbing;
    }

.um-order-number {
    font-size: 0.7rem;
    font-weight: 700;
    color: #6b7280;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 4px;
}

/* Dragging state */
.um-module-card.um-dragging {
    opacity: 0.4;
    border: 2px dashed #3b82f6;
    background: #eff6ff;
}

/* Drop target */
.um-module-card.um-drag-over {
    border-top: 3px solid #3b82f6;
}

/* Touch clone */
.um-touch-clone {
    position: fixed;
    z-index: 100001;
    pointer-events: none;
    opacity: 0.85;
    transform: rotate(2deg) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

/* Sortable list indicator */
.um-sortable {
    min-height: 100px;
}

/* ============================================
   PERMISSION BADGES & PANEL
   ============================================ */
.um-permissions {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.um-perm-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background: #f3f4f6;
    color: #9ca3af;
}

.um-perm-active {
    background: #dbeafe;
    color: #1e40af;
}

.um-permissions-panel {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.um-perm-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

    .um-perm-grid label {
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: 0.8rem;
        color: #4b5563;
        cursor: pointer;
    }

    .um-perm-grid input {
        accent-color: #3b82f6;
    }

/* ============================================
   EMPTY & LOADING
   ============================================ */
.um-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #9ca3af;
}

    .um-empty i {
        font-size: 2.5rem;
        margin-bottom: 8px;
    }

    .um-empty p {
        margin: 0;
        font-size: 0.85rem;
    }

.um-error {
    color: #ef4444;
}

.um-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    color: #9ca3af;
    gap: 12px;
}

.um-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: umSpin 0.8s linear infinite;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.um-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100002;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.um-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.85rem;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
}

.um-toast-show {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   BUTTON INJECT STYLE
   ============================================ */
.btn-user-modules {
    padding: 2px 8px !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes umFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes umSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes umSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .um-content {
        grid-template-columns: 1fr;
    }

    .um-column:first-child {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        max-height: 35vh;
    }

    .um-toolbar {
        flex-direction: column;
    }

    .um-toolbar-right {
        width: 100%;
        justify-content: flex-start;
    }

    .um-modal {
        width: 98%;
        max-height: 95vh;
        margin: 8px;
    }
}
