 /* Container principale per tutte le modali */
#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 56px);
    overflow: hidden;
    pointer-events: none;
    z-index: 1000;
}

button.window-control.minimize {
    background-color: #3f953f;
}

button.window-control.maximize {
    background-color: #39399c;
}

button.window-control.close {
    background-color: #c41e1e;
}

/* Stile base della modale */
.window-modal {
    position: fixed;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    min-width: 300px;
    min-height: 200px;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
    border-radius: var(--border-radius-md);
    overflow-y: auto;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.95);
    max-height: calc(100vh - 56px) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(201, 169, 97, 0.2);
}

.window-modal.minimized {
    display: none;
}

.window-modal.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100vh - 56px) !important;
    border-radius: 0;
}

/* Header della modale */
.window-header {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
    height: 48px;
    background: var(--navy);
    border-bottom: 1px solid rgba(201, 169, 97, 0.15);
}

.window-modal.inactive {
    background: var(--white);
}

.window-modal.inactive .window-header {
    background: var(--navy-light);
    color: var(--text-on-dark);
}

.window-modal .window-header {
    background: var(--navy);
    color: var(--gold);
}

.window-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    letter-spacing: 0.5px;
}

/* Controlli della finestra */
.window-controls {
    display: flex;
    gap: 4px;
}

.window-control {
    width: 32px;
    height: 28px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s;
    font-size: 16px;
}

.window-modal.inactive .window-control {
    color: var(--text-on-dark);
}

.window-control:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.window-control.close:hover {
    background-color: #e81123;
    color: white;
}

.window-control.minimize:hover {
    background-color: #53bb53;
    color: white;
}

.window-control.maximize:hover {
    background-color: #5252ea;
    color: white;
}

/* Contenuto della modale */
.window-content {
    flex: 1;
    overflow: auto;
    padding: 24px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-dark);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

.window-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Resize handle */
.resize-handle {
    position: absolute;
    background: transparent;
}

.resize-handle.n {
    top: 0;
    left: 10px;
    right: 10px;
    height: 5px;
    cursor: ns-resize;
}

.resize-handle.s {
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 5px;
    cursor: ns-resize;
}

.resize-handle.e {
    right: 0;
    top: 10px;
    bottom: 10px;
    width: 5px;
    cursor: ew-resize;
}

.resize-handle.w {
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 5px;
    cursor: ew-resize;
}

.resize-handle.ne {
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    cursor: nesw-resize;
}

.resize-handle.nw {
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    cursor: nwse-resize;
}

.resize-handle.se {
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    cursor: nwse-resize;
}

.resize-handle.sw {
    bottom: 0;
    left: 0;
    width: 10px;
    height: 10px;
    cursor: nesw-resize;
}

/* Menu highlighting quando minimizzato */
.menu-item {
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: #f0f0f0;
}

.menu-item.has-minimized-window {
    background-color: #e3f2fd;
    border-left: 3px solid var(--gold);
}

/* Loading spinner */
.window-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 14px;
    color: var(--text-muted);
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--gold);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

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


/* Stili specifici per le modali di dettaglio */
.detail-modal {
    position: fixed;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius-md);
    max-height: calc(100vh - 56px) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(201, 169, 97, 0.2);
}

.detail-modal .window-header {
    border-bottom: 1px solid rgba(201, 169, 97, 0.15);
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    background: var(--navy);
    height: 48px;
}

.detail-modal .window-title {
    font-weight: 700;
    font-size: 14px;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.detail-modal .window-controls {
    display: flex;
    gap: 4px;
}

.detail-modal .window-control {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.2s;
}

.detail-modal .window-control:hover {
    background: rgba(0, 0, 0, 0.1);
}

.detail-modal .window-control.close:hover {
    background: #e74c3c;
    color: white;
}

.detail-modal .window-content {
    flex: 1;
    overflow: auto;
    border-radius: 0 0 8px 8px;
}

.detail-modal .window-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.detail-modal .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.detail-modal :has(.chat-container) {
    overflow: hidden;
    height: 100%;
}

/* Resize handles per modali di dettaglio */
.detail-modal .resize-handle {
    position: absolute;
    background: transparent;
}

.detail-modal .resize-handle.n,
.detail-modal .resize-handle.s {
    left: 0;
    right: 0;
    height: 6px;
    cursor: ns-resize;
}

.detail-modal .resize-handle.n {
    top: 0;
}

.detail-modal .resize-handle.s {
    bottom: 0;
}

.detail-modal .resize-handle.e,
.detail-modal .resize-handle.w {
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
}

.detail-modal .resize-handle.e {
    right: 0;
}

.detail-modal .resize-handle.w {
    left: 0;
}

.detail-modal .resize-handle.ne,
.detail-modal .resize-handle.nw,
.detail-modal .resize-handle.se,
.detail-modal .resize-handle.sw {
    width: 12px;
    height: 12px;
}

.detail-modal .resize-handle.ne {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.detail-modal .resize-handle.nw {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

.detail-modal .resize-handle.se {
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
}

.detail-modal .resize-handle.sw {
    bottom: 0;
    left: 0;
    cursor: nesw-resize;
}

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

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

.dashboard-modal {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius-md);
    padding-bottom: 40px;
    backdrop-filter: blur(10px);
}

.dashboard-modal:has(textarea#InputMessage) {
    max-height: 500px;
    overflow: auto;
    width: 50% !important;
    left: 27%;
}

.dashboard-modal:has(textarea#InputMessage)::-webkit-scrollbar {
    width: 10px;
}

.dashboard-modal:has(textarea#InputMessage)::-webkit-scrollbar-track {
    background: #f8f8f8;
    border-radius: 5px;
    margin: 10px 0;
}

.dashboard-modal:has(textarea#InputMessage)::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 5px;
    border: 2px solid var(--white);
}

.dashboard-modal:has(textarea#InputMessage)::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
.row-for-modal {
    display: flex;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .dashboard-modal:has(textarea#InputMessage) {
        width: 75% !important;
    }
}
