﻿:root {
    --navy-900: #0a0f1e;
    --navy-800: #111827;
    --navy-700: #1a2235;
    --navy-600: #243049;
    --teal-500: #14b8a6;
    --teal-400: #2dd4bf;
    --teal-300: #5eead4;
    --gray-300: #94a3b8;
    --gray-400: #64748b;
    --gray-500: #475569;
    --white: #ffffff;
    --sidebar-width: 260px;
    --topbar-height: 56px;
}

/* === LAYOUT GENERALE === */
.cpm-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #f1f5f9;
    font-family: 'DM Sans', sans-serif;
}

/* === SIDEBAR === */
.cpm-sidebar {
    width: var(--sidebar-width);
    background: var(--navy-900);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

    .cpm-sidebar::-webkit-scrollbar {
        width: 4px;
    }

    .cpm-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }

    .cpm-sidebar::-webkit-scrollbar-thumb {
        background: rgba(45,212,191,0.2);
        border-radius: 4px;
    }

/* Logo area */
.cpm-logo {
    padding: 24px 20px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(45,212,191,0.1);
    margin-bottom: 8px;
    flex-shrink: 0;
}

.cpm-logo-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.cpm-logo-text {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 17px;
    line-height: 1;
}

    .cpm-logo-text .pro {
        color: var(--teal-400);
        font-weight: 700;
    }

    .cpm-logo-text .manager {
        color: var(--white);
        font-weight: 400;
    }

/* Nav items */
.cpm-nav {
    flex: 1;
    padding: 8px 0;
}

.cpm-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--gray-300);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    user-select: none;
}

    .cpm-nav-item:hover {
        background: rgba(45,212,191,0.06);
        color: var(--white);
    }

    .cpm-nav-item.active {
        background: rgba(45,212,191,0.1);
        color: var(--teal-400);
        border-left-color: var(--teal-400);
    }

    .cpm-nav-item svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        opacity: 0.8;
    }

    .cpm-nav-item.active svg {
        opacity: 1;
    }

/* Gruppo con sottomenu */
.cpm-nav-group {
}

.cpm-nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    color: var(--gray-300);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    user-select: none;
}

    .cpm-nav-group-header:hover {
        background: rgba(45,212,191,0.06);
        color: var(--white);
    }

    .cpm-nav-group-header .left {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .cpm-nav-group-header svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        opacity: 0.8;
    }

.cpm-chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
    opacity: 0.5;
}

    .cpm-chevron.open {
        transform: rotate(180deg);
    }

/* Sottomenu */
.cpm-submenu {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}

    .cpm-submenu.open {
        max-height: 300px;
    }

.cpm-submenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px 8px 48px;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s;
    cursor: pointer;
}

    .cpm-submenu-item:hover {
        color: var(--white);
        background: rgba(45,212,191,0.04);
    }

    .cpm-submenu-item.active {
        color: var(--teal-400);
    }

    .cpm-submenu-item svg {
        width: 15px;
        height: 15px;
        opacity: 0.7;
    }

/* Footer sidebar */
.cpm-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(45,212,191,0.1);
    font-size: 11px;
    color: var(--gray-500);
    flex-shrink: 0;
}

/* === MAIN AREA === */
.cpm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Topbar */
.cpm-topbar {
    height: var(--topbar-height);
    background: var(--navy-800);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(45,212,191,0.1);
}

.cpm-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cpm-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cpm-page-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--white);
}

/* User menu */
.cpm-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(45,212,191,0.08);
    border: 1px solid rgba(45,212,191,0.2);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--white);
    font-size: 13px;
    transition: all 0.15s;
    position: relative;
}

    .cpm-user-btn:hover {
        background: rgba(45,212,191,0.14);
        border-color: rgba(45,212,191,0.35);
    }

.cpm-user-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--teal-500), #0891b2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

/* Dropdown user menu */
.cpm-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--navy-700);
    border: 1px solid rgba(45,212,191,0.15);
    border-radius: 10px;
    min-width: 180px;
    padding: 6px 0;
    z-index: 1000;
    display: none;
}

    .cpm-dropdown.open {
        display: block;
    }

.cpm-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--gray-300);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

    .cpm-dropdown-item:hover {
        background: rgba(45,212,191,0.08);
        color: var(--white);
    }

    .cpm-dropdown-item svg {
        width: 15px;
        height: 15px;
        opacity: 0.7;
    }

.cpm-dropdown-divider {
    height: 1px;
    background: rgba(45,212,191,0.1);
    margin: 4px 0;
}

.cpm-dropdown-item.danger {
    color: #f87171;
}

    .cpm-dropdown-item.danger:hover {
        background: rgba(248,113,113,0.08);
    }

/* Contenuto pagina */
.cpm-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    background: #f1f5f9;
}

    .cpm-content::-webkit-scrollbar {
        width: 6px;
    }

    .cpm-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .cpm-content::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }

/* === DASHBOARD CARDS === */
.cpm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.cpm-kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px 24px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cpm-kpi-value {
    font-size: 36px;
    font-weight: 600;
    color: var(--navy-900);
    line-height: 1;
}

    .cpm-kpi-value.alert {
        color: #f87171;
    }

.cpm-kpi-label {
    font-size: 13px;
    color: var(--gray-400);
}

.cpm-kpi-icon {
    width: 36px;
    height: 36px;
    background: rgba(20,184,166,0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

    .cpm-kpi-icon svg {
        width: 18px;
        height: 18px;
        color: var(--teal-500);
    }

/* === SEZIONI DASHBOARD === */
.cpm-section {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
    overflow: hidden;
}

.cpm-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 15px;
    font-weight: 500;
    color: var(--navy-900);
}

    .cpm-section-header svg {
        width: 18px;
        height: 18px;
        color: var(--teal-500);
    }

.cpm-section-body {
    padding: 16px 20px;
}

.cpm-empty {
    font-size: 14px;
    color: var(--gray-400);
    padding: 8px 0;
}

/* Tabella alert costi */
.cpm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .cpm-table th {
        text-align: left;
        padding: 8px 12px;
        color: var(--gray-400);
        font-weight: 500;
        border-bottom: 1px solid #f1f5f9;
    }

    .cpm-table td {
        padding: 10px 12px;
        color: var(--navy-900);
        border-bottom: 1px solid #f8fafc;
    }

    .cpm-table tr:last-child td {
        border-bottom: none;
    }

.cpm-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
}

    .cpm-badge.warning {
        background: rgba(251,191,36,0.12);
        color: #92400e;
    }

    .cpm-badge.danger {
        background: rgba(248,113,113,0.12);
        color: #991b1b;
    }

/* Benvenuto header */
.cpm-welcome {
    margin-bottom: 24px;
}

    .cpm-welcome h1 {
        font-size: 22px;
        font-weight: 600;
        color: var(--navy-900);
        margin: 0 0 4px;
    }

    .cpm-welcome p {
        font-size: 14px;
        color: var(--gray-400);
        margin: 0;
    }

    .cpm-welcome strong {
        color: var(--navy-800);
    }

/* Responsive */
@media (max-width: 1024px) {
    .cpm-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .cpm-sidebar {
        display: none;
    }

    .cpm-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === PAGE HEADER === */
.cpm-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.cpm-page-title-h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--navy-900);
    margin: 0 0 2px;
}

.cpm-page-subtitle {
    font-size: 13px;
    color: var(--gray-400);
}

.cpm-page-header-right {
    display: flex;
    gap: 10px;
}

/* === BUTTONS === */
.cpm-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    font-family: 'DM Sans', sans-serif;
}

.cpm-btn-primary {
    background: linear-gradient(135deg, #14b8a6 0%, #0891b2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(20,184,166,0.25);
}

    .cpm-btn-primary:hover {
        box-shadow: 0 4px 14px rgba(20,184,166,0.4);
        transform: translateY(-1px);
    }

.cpm-btn-secondary {
    background: white;
    color: var(--gray-500);
    border: 1px solid #e2e8f0;
}

    .cpm-btn-secondary:hover {
        background: #f8fafc;
        border-color: #cbd5e1;
    }

.cpm-btn-danger {
    background: #f87171;
    color: white;
}

    .cpm-btn-danger:hover {
        background: #ef4444;
        transform: translateY(-1px);
    }

.cpm-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* === CARD === */
.cpm-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

/* === GRID ACTIONS === */
.cpm-grid-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cpm-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

    .cpm-icon-btn.edit {
        background: rgba(20,184,166,0.1);
        color: #14b8a6;
    }

        .cpm-icon-btn.edit:hover {
            background: rgba(20,184,166,0.2);
        }

    .cpm-icon-btn.delete {
        background: rgba(248,113,113,0.1);
        color: #f87171;
    }

        .cpm-icon-btn.delete:hover {
            background: rgba(248,113,113,0.2);
        }

/* === DIALOG === */
.cpm-dialog-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--navy-900);
}

    .cpm-dialog-header.danger {
        color: #ef4444;
    }

.cpm-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 4px 0;
}

/* === FORM === */
.cpm-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cpm-form-row {
    display: flex;
    gap: 14px;
    align-items: flex-end;
}

.cpm-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

    .cpm-form-group label {
        font-size: 12px;
        font-weight: 500;
        color: var(--gray-400);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

.cpm-form-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(248,113,113,0.08);
    border: 1px solid rgba(248,113,113,0.25);
    border-radius: 8px;
    font-size: 13px;
    color: #ef4444;
}

/* === SPINNER === */
.cpm-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

/* === SYNCFUSION OVERRIDE === */
.cpm-grid .e-gridheader {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.cpm-grid .e-headercell {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--gray-400) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

.cpm-grid .e-rowcell {
    font-size: 13px !important;
    color: var(--navy-900) !important;
    border-bottom: 1px solid #f8fafc !important;
}

.cpm-grid .e-row:hover .e-rowcell {
    background: #f0fdf9 !important;
}

/* Bottone costo orario */
.cpm-icon-btn.costo {
    background: rgba(99,102,241,0.1);
    color: #6366f1;
}

    .cpm-icon-btn.costo:hover {
        background: rgba(99,102,241,0.2);
    }

/* Badge inline attivo/inattivo */
.cpm-badge-inline {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
}

    .cpm-badge-inline.active {
        background: rgba(20,184,166,0.12);
        color: #0d9488;
    }

    .cpm-badge-inline.inactive {
        background: rgba(100,116,139,0.12);
        color: #64748b;
    }

/* Separatore sezione nel dialog */
.cpm-section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    color: var(--gray-400);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

    .cpm-section-divider::before,
    .cpm-section-divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background: #e2e8f0;
    }

/* === LOGO UPLOAD === */
.cpm-logo-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cpm-logo-preview {
    display: flex;
    align-items: center;
    gap: 12px;
}

    .cpm-logo-preview img {
        height: 60px;
        max-width: 180px;
        object-fit: contain;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
        padding: 4px;
        background: #f8fafc;
    }

.cpm-file-input {
    font-size: 13px;
    color: var(--gray-400);
}

.cpm-file-hint {
    font-size: 11px;
    color: var(--gray-500);
}

/* === SCHEDULE === */
.cpm-schedule-wrap {
    padding: 0;
    overflow: hidden;
}

.cpm-filter-dd {
    min-width: 180px;
}

.cpm-event-template {
    padding: 2px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

/* Editor dialog personalizzato */
.cpm-editor {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 0;
}

.cpm-editor-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cpm-editor-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy-900);
    margin-bottom: 4px;
}

    .cpm-editor-section-title svg {
        color: var(--teal-500);
    }

/* Override Syncfusion Schedule */
.e-schedule .e-header-bar {
    background: var(--navy-800) !important;
    color: white !important;
}

    .e-schedule .e-header-bar .e-navigate-arrow,
    .e-schedule .e-header-bar .e-date-range {
        color: white !important;
    }

.e-schedule .e-toolbar-items .e-active-view .e-tbar-btn {
    background: var(--teal-500) !important;
    color: white !important;
    border-radius: 6px !important;
}

.e-schedule .e-today-button {
    color: var(--teal-500) !important;
}

.e-schedule .e-appointment {
    border-radius: 4px !important;
    border: none !important;
}

/* Forza trasparenza sul wrapper Syncfusion per far vedere il nostro colore */
.e-schedule .e-appointment {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

    .e-schedule .e-appointment .e-appointment-details {
        padding: 0 !important;
        height: 100% !important;
    }

    .e-schedule .e-appointment .e-subject {
        display: none !important;
    }

/* === COLOR PALETTE === */
.cpm-color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.cpm-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
    padding: 0;
}

    .cpm-color-swatch:hover {
        transform: scale(1.15);
        box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    }

    .cpm-color-swatch.selected {
        border: 2px solid white;
        box-shadow: 0 0 0 3px rgba(0,0,0,0.25);
        transform: scale(1.1);
    }