/**
 * ComplyHub - Microsoft Office 365 / Fluent UI Ribbon Navigation System
 * @version 2.0.0
 * @date Settembre 2026
 */

:root {
    --office-dark-bg: #0f172a;
    --office-dark-border: rgba(255, 255, 255, 0.1);
    --office-ribbon-bg: #ffffff;
    --office-ribbon-border: #e2e8f0;
    --office-toolbar-bg: #f8fafc;
    --office-primary: #0284c7;
    --office-primary-hover: #0369a1;
    --office-text-dark: #0f172a;
    --office-text-muted: #64748b;
    --office-hover-bg: rgba(2, 132, 199, 0.08);
    --text-color: #0f172a;
    --text-primary: #0f172a;
}

/* Corpo pagina con sfondo chiaro neutro e testo scuro ad alto contrasto */
body {
    background-color: var(--bg-panel, #f8fafc) !important;
    color: var(--text-primary, #0f172a) !important;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Reset layout wrapper full-width */
.layout-wrapper {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Disattivazione vecchie sidebar verticali */
.macro-sidebar,
.sub-sidebar,
.sidebar-overlay,
.sidebar-toggle {
    display: none !important;
}

/* Main Content full-width */
.main-content {
    margin-left: 0 !important;
    padding: 1.5rem 2rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.content-body {
    width: 100% !important;
    max-width: 100% !important;
}

/* =========================================================
   1. TOP APPLICATION BAR (Office 365 Global App Header)
   ========================================================= */
.office-top-header {
    background: #0b1120;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    height: 54px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.office-brand-area {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 260px;
}
.office-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    line-height: 1;
    flex-shrink: 0;
}
.office-logo-img {
    height: 38px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    display: block;
    filter: brightness(1.15) contrast(1.05);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), filter 0.2s ease;
}
.office-logo:hover .office-logo-img {
    transform: scale(1.03);
    filter: brightness(1.25) contrast(1.08);
}
.office-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.95rem;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
}
.office-tenant-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.badge-banca {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
}
.badge-agente {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #10b981;
}
.badge-saas {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: #fbbf24;
}
.badge-commercial {
    background: rgba(129, 140, 248, 0.15);
    border: 1px solid rgba(129, 140, 248, 0.35);
    color: #818cf8;
}
.badge-compliance {
    background: rgba(45, 212, 191, 0.15);
    border: 1px solid rgba(45, 212, 191, 0.35);
    color: #2dd4bf;
}
.badge-operator {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #60a5fa;
}
.badge-auditor {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #fb7185;
}

/* Selettore Rete / Agenzia per Banche */
.office-subtenant-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 0.2rem 0.6rem;
    transition: all 0.2s ease;
}
.office-subtenant-switcher:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #38bdf8;
}
.office-subtenant-select {
    background: transparent;
    border: none;
    color: #f1f5f9;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}
.office-subtenant-select option {
    background: #0f172a;
    color: #ffffff;
}

/* Barra di ricerca globale Office 365 */
.office-search-wrapper {
    flex: 1;
    max-width: 520px;
    position: relative;
}
.office-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.45rem 1rem 0.45rem 2.4rem;
    font-size: 0.85rem;
    color: #f8fafc;
    outline: none;
    transition: all 0.2s ease;
}
.office-search-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}
.office-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: #94a3b8;
    pointer-events: none;
}

/* Area Utente & Notifiche */
.office-user-area {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.office-nav-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    position: relative;
}
.office-nav-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.office-badge-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
}
.office-user-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.25rem 0.75rem 0.25rem 0.4rem;
    border-radius: 24px;
}
.office-avatar {
    width: 28px;
    height: 28px;
    background: #0284c7;
    color: #fff;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.office-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
}
.office-btn-logout {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
}
.office-btn-logout:hover {
    background: #ef4444;
    color: #fff;
}

/* =========================================================
   2. PRIMARY RIBBON STRIP (Schede Principali Office 365)
   ========================================================= */
.office-ribbon-container {
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 54px;
    z-index: 990;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.office-ribbon-tabs {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: #0d1527;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
    scrollbar-width: none;
}
.office-ribbon-tabs::-webkit-scrollbar {
    display: none;
}

.office-ribbon-tab {
    padding: 0.65rem 1.15rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #94a3b8;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.office-ribbon-tab:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.03);
}
.office-ribbon-tab.active {
    color: #38bdf8;
    border-bottom-color: #38bdf8;
    background: rgba(56, 189, 248, 0.05);
}

/* Pulsante comprimi / espandi ribbon */
.office-ribbon-toggle {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}
.office-ribbon-toggle:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}
.office-ribbon-toggle.pinned {
    background: rgba(2, 132, 199, 0.15);
    border-color: rgba(2, 132, 199, 0.35);
    color: #38bdf8;
}

/* =========================================================
   3. CONTEXTUAL RIBBON ACTION TOOLBAR (Pulsanti di Scelta Rapida)
   ========================================================= */
.office-ribbon-toolbar {
    padding: 0.65rem 1.5rem;
    background: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: max-height 0.2s ease, opacity 0.2s ease;
}
.office-ribbon-toolbar.collapsed {
    display: none !important;
}

/* Modalità Flyout Overlay: quando la ribbon è sbloccata ma l'utente clicca una scheda per selezionare un sottomenu */
.office-ribbon-toolbar.flyout-open {
    display: flex !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: #0f172a !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 2px solid #0284c7 !important;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.65), 0 8px 16px -2px rgba(0, 0, 0, 0.45) !important;
    z-index: 1050 !important;
    animation: ribbonFlyoutIn 0.15s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes ribbonFlyoutIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.office-action-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    position: relative;
}
.office-group-divider {
    width: 1px;
    height: 38px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 0.5rem;
}

/* Pulsante azione in stile Microsoft Fluent */
.office-btn-action {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.65rem;
    min-width: 65px;
    height: 52px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.office-btn-action:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #38bdf8;
    transform: translateY(-1px);
}
.office-btn-action.active {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    font-weight: 700;
}
.office-action-icon {
    font-size: 1.25rem;
    line-height: 1;
    margin-bottom: 0.2rem;
}
.office-action-label {
    line-height: 1.1;
}

/* Pulsante primario risaltato (es. "+ Nuova Pratica") */
.office-btn-action.primary-action {
    background: rgba(2, 132, 199, 0.15);
    border-color: rgba(2, 132, 199, 0.35);
    color: #38bdf8;
    font-weight: 700;
}
.office-btn-action.primary-action:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

/* Nasconde le vecchie barre top-navbar se presenti */
.top-navbar {
    display: none !important;
}

/* Responsive Ribbon & Header su schermi medi e smartphone */
@media (max-width: 992px) {
    .office-top-header {
        padding: 0 1rem;
    }
    .office-brand-area {
        min-width: auto;
        gap: 0.65rem;
    }
    .office-logo-img {
        height: 34px;
        max-width: 130px;
    }
    .office-search-wrapper {
        display: none;
    }
    .office-ribbon-tabs {
        padding: 0 0.75rem;
    }
    .office-ribbon-tab {
        padding: 0.5rem 0.85rem;
        font-size: 0.82rem;
    }
    .main-content {
        padding: 1rem !important;
    }
}

@media (max-width: 768px) {
    .office-top-header {
        padding: 0 0.75rem;
        gap: 0.75rem;
    }
    .office-brand-area {
        min-width: auto;
        gap: 0.5rem;
    }
    .office-logo-img {
        height: 30px;
        max-width: 110px;
    }
    .office-tenant-badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.45rem;
        white-space: nowrap;
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        vertical-align: middle;
    }
    .office-user-name {
        display: none;
    }
    .office-user-pill {
        padding: 0.2rem;
    }
}

@media (max-width: 640px) {
    .office-tenant-badge {
        display: none !important;
    }
    .office-logo-img {
        height: 28px;
        max-width: 100px;
    }
}

@media (max-width: 480px) {
    .office-top-header {
        padding: 0 0.5rem;
        gap: 0.4rem;
        height: 50px;
    }
    .office-brand-area {
        gap: 0.35rem;
    }
    .office-logo-img {
        height: 26px;
        max-width: 90px;
    }
    .office-btn-logout {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }
    .office-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }
}

/* =========================================================
   4. MODAL & DIALOG WINDOWS HIGH-CONTRAST READABILITY
   ========================================================= */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(15, 23, 42, 0.7) !important;
    backdrop-filter: blur(4px) !important;
    z-index: 2000 !important;
}

.modal-content {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

.modal-title {
    color: #0f172a !important;
    font-weight: 700 !important;
}

.modal-content h1,
.modal-content h2,
.modal-content h3,
.modal-content h4,
.modal-content h5,
.modal-content h6 {
    color: #0f172a !important;
}

.modal-content p,
.modal-content span:not(.badge):not(.office-action-icon),
.modal-content div:not(.alert):not(.badge):not(.office-action-icon),
.modal-content label,
.modal-content strong,
.modal-content b,
.modal-content em,
.modal-content li,
.modal-content td,
.modal-content th {
    color: #0f172a;
}

.modal-content small,
.modal-content .text-muted {
    color: #64748b !important;
}

.modal-content code {
    background-color: #f1f5f9 !important;
    color: #0284c7 !important;
    border: 1px solid #e2e8f0 !important;
    padding: 0.15rem 0.4rem !important;
    border-radius: 4px !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-size: 0.9em !important;
    font-weight: 600 !important;
}

.modal-content .form-label,
.modal-content label {
    color: #0f172a !important;
    font-weight: 600 !important;
}

.modal-content .form-control {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

.modal-content .form-control:focus {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #0284c7 !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
}

.modal-content .form-control::placeholder {
    color: #94a3b8 !important;
}

.modal-content .btn-secondary {
    background-color: #f8fafc !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
    font-weight: 600 !important;
}

.modal-content .btn-secondary:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

.modal-content .table {
    color: #0f172a !important;
}

.modal-content .table th {
    color: #475569 !important;
    background-color: #f8fafc !important;
}

.modal-content .table td {
    color: #0f172a !important;
}

