/* Coralis CRM - Stile Portale Clienti v1.0 */

/* === 1. VARIABILI E BASE === */
:root {
    --portal-primary: #6366f1; /* Indigo */
    --portal-secondary: #10b981; /* Green */
    --portal-text: #374151;
    --portal-text-light: #6b7280;
    --portal-bg: #f9fafb;
    --portal-card-bg: #ffffff;
    --portal-border: #e5e7eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--portal-bg);
    color: var(--portal-text);
    line-height: 1.6;
    font-size: 16px;
}

a { color: var(--portal-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === 2. LAYOUT PRINCIPALE (PER PAGINE AUTENTICATE) === */
.portal-container {
    display: flex;
    min-height: 100vh;
}

.portal-sidebar {
    width: 240px;
    background-color: #1e293b;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100%;
    z-index: 40;
    transition: transform 0.2s ease;
}

.portal-sidebar .logo {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
}
.portal-sidebar .logo img {
    display: block;
    max-width: 170px;
    height: auto;
    margin: 0 auto;
}

.portal-nav ul { list-style: none; }
.portal-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}
.portal-nav a:hover { background-color: #334155; color: white; }
.portal-nav a.active { background-color: var(--portal-primary); color: white; font-weight: 600; }

.portal-sidebar .user-info {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid #334155;
    text-align: center;
}
.portal-sidebar .user-info .company-name { font-weight: 600; color: white; }
.portal-sidebar .user-info .contact-name { font-size: 0.9rem; }
.portal-sidebar .user-info a { display: block; margin-top: 1rem; }

.portal-main {
    flex: 1;
    margin-left: 240px;
    padding: 0;
    overflow-x: hidden;
}

.portal-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-bottom: 1px solid var(--portal-border);
    position: sticky;
    top: 0;
    z-index: 30;
}
.portal-topbar .brand {
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.portal-hamburger {
    width: 40px;
    height: 40px;
    border: 1px solid var(--portal-border);
    background: #ffffff;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.portal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 30;
}
.portal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* === 3. LOGIN & PAGINE DI ACCESSO === */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
    background: var(--portal-card-bg);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-card h1 { margin-bottom: 2rem; }
.form-group { margin-bottom: 1.5rem; text-align: left; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    font-size: 1rem;
}
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-primary { background-color: var(--portal-primary); color: white; width: 100%; }
.btn-primary:hover { opacity: 0.9; }
.login-footer { margin-top: 1.5rem; font-size: 0.9rem; }
.alert { padding: 1rem; border-radius: 0.5rem; margin-bottom: 1.5rem; }
.alert-danger { background-color: #fee2e2; color: #dc2626; }
.alert-success { background-color: #dcfce7; color: #166534; }

/* === 4. COMPONENTI COMUNI DEL PORTALE === */
.page-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--portal-border);
    padding-bottom: 1rem;
}
.page-header h1 { font-size: 2rem; color: #111827; }
.page-header p { color: var(--portal-text-light); }

.portal-card {
    background-color: var(--portal-card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}
.portal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.portal-card-header h2 { font-size: 1.25rem; margin: 0; }

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}
.status-badge.active { background-color: #dcfce7; color: #166534; }
.status-badge.suspended { background-color: #fef3c7; color: #92400e; }
.status-badge.expired { background-color: #fee2e2; color: #b91c1c; }
.status-badge.pending { background-color: #dbeafe; color: #1e40af; }
.status-badge.wip { background-color: #e5e7eb; color: #4b5563; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* === RESPONSIVE === */
@media (max-width: 992px) {
    .portal-sidebar { transform: translateX(-100%); }
    .portal-sidebar.open { transform: translateX(0); }
    .portal-main { margin-left: 0; max-width: 100vw; }
    .portal-topbar { display: flex; }
}

/* Tabelle semplici */
.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.portal-table th,
.portal-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--portal-border);
    text-align: left;
}
.portal-table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--portal-text-light);
    letter-spacing: 0.04em;
    background: #f8fafc;
}
.portal-table .muted {
    color: var(--portal-text-light);
    font-size: 0.85rem;
}
/* Aggiungere alla fine del file portal.css */

.portal-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--portal-border);
    text-align: center;
    color: var(--portal-text-light);
    font-size: 0.9rem;
}

.portal-footer p {
    margin-bottom: 0.5rem;
}

.portal-footer a {
    color: var(--portal-text-light);
    margin: 0 0.5rem;
}
.portal-footer a:hover {
    color: var(--portal-primary);
}
/* Coralis Portal - CSS Migliorato v2.0 */

/* === 1. VARIABILI E BASE === */
:root {
    --portal-primary: #6366f1;
    --portal-secondary: #10b981;
    --portal-text: #374151;
    --portal-text-light: #6b7280;
    --portal-bg: #f9fafb;
    --portal-card-bg: #ffffff;
    --portal-border: #e5e7eb;
    --portal-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --portal-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Colori di stato */
    --primary: #6366f1;
    --secondary: #10b981;
    --info: #3b82f6;
    --warning: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
}

/* Reset e base */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--portal-bg);
    color: var(--portal-text);
    line-height: 1.6;
    font-size: 16px;
}

a { color: var(--portal-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === 2. LAYOUT PRINCIPALE === */
.portal-container {
    display: flex;
    min-height: 100vh;
}

.portal-sidebar {
    width: 260px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100%;
    box-shadow: 4px 0 6px -1px rgba(0, 0, 0, 0.1);
}

.portal-sidebar .logo {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    backdrop-filter: blur(10px);
}
.portal-sidebar .logo img {
    display: block;
    max-width: 160px;
    max-height: 48px;
    width: 100%;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}
.portal-sidebar .logo i { color: var(--portal-primary); margin-right: 0.5rem; }

.portal-nav ul { list-style: none; }
.portal-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    font-weight: 500;
}
.portal-nav a:hover { 
    background: rgba(255, 255, 255, 0.1); 
    color: white; 
    text-decoration: none;
    transform: translateX(4px);
}
.portal-nav a.active { 
    background: var(--portal-primary); 
    color: white; 
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.portal-nav a i { width: 20px; font-size: 1.1rem; }

.portal-sidebar .user-info {
    margin-top: auto;
    padding: 1.5rem 1rem;
    border-top: 1px solid #334155;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    margin-top: 2rem;
}
.portal-sidebar .user-info .company-name { 
    font-weight: 600; 
    color: white; 
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.portal-sidebar .user-info .contact-name { 
    font-size: 0.8rem; 
    color: #94a3b8;
    margin-bottom: 1rem;
}
.portal-sidebar .user-info a { 
    display: inline-block; 
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}
.portal-sidebar .user-info a:hover {
    background: rgba(239, 68, 68, 0.3);
    text-decoration: none;
}

.portal-main {
    flex: 1;
    margin-left: 260px;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: calc(100vw - 260px);
}

/* === 3. COMPONENTI PRINCIPALI === */
.page-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--portal-border);
}
.page-header h1 { 
    font-size: 2.5rem; 
    color: #111827; 
    margin-bottom: 0.5rem;
    font-weight: 700;
}
.page-header p { 
    color: var(--portal-text-light); 
    font-size: 1.1rem;
}

.portal-card {
    background: var(--portal-card-bg);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--portal-shadow);
    margin-bottom: 2rem;
    border: 1px solid var(--portal-border);
    transition: all 0.3s ease;
}
.portal-card:hover {
    box-shadow: var(--portal-shadow-lg);
    transform: translateY(-2px);
}

.portal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--portal-border);
}
.portal-card-header h2 { 
    font-size: 1.5rem; 
    margin: 0;
    color: var(--portal-text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.portal-card-header h2 i {
    color: var(--portal-primary);
    font-size: 1.2rem;
}

/* === 4. GRID LAYOUTS === */
.content-grid-unified {
    display: grid;
    gap: 2rem;
    align-items: start;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.kpi-mini {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--portal-card-bg);
    border-radius: 0.75rem;
    border-left: 4px solid;
    box-shadow: var(--portal-shadow);
    transition: all 0.3s ease;
}
.kpi-mini:hover {
    transform: translateY(-2px);
    box-shadow: var(--portal-shadow-lg);
}
.kpi-mini.primary { border-left-color: var(--primary); }
.kpi-mini.info { border-left-color: var(--info); }
.kpi-mini.warning { border-left-color: var(--warning); }
.kpi-mini.success { border-left-color: var(--success); }
.kpi-mini.danger { border-left-color: var(--danger); }

.kpi-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.kpi-label {
    font-size: 0.9rem;
    color: var(--portal-text-light);
    font-weight: 500;
}

/* === 5. STATUS BADGES === */
.status-badge {
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}
.status-badge.primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.status-badge.secondary { background: rgba(16, 185, 129, 0.1); color: var(--secondary); }
.status-badge.info { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.status-badge.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status-badge.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-badge.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.status-badge.active { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-badge.suspended { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status-badge.expired { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* === 6. SERVIZI E CONTRATTI === */
.service-status {
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--portal-border);
}
.service-status.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.02) 100%);
    border-color: rgba(16, 185, 129, 0.2);
}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.service-category {
    background: var(--portal-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    color: var(--portal-text-light);
    font-weight: 500;
}

.service-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--portal-text);
    margin-bottom: 1rem;
}

.service-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.service-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--portal-border);
}
.service-detail:last-child {
    border-bottom: none;
}
.service-detail .label {
    font-size: 0.9rem;
    color: var(--portal-text-light);
}
.service-detail .value {
    font-weight: 600;
    color: var(--portal-text);
}
.service-detail .value.highlight {
    color: var(--portal-primary);
    font-weight: 700;
}

/* === 7. QUICK LINKS === */
.quick-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.quick-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--portal-bg);
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}
.quick-link:hover {
    background: var(--portal-primary);
    color: white;
    text-decoration: none;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.quick-link i {
    font-size: 1.2rem;
    color: var(--portal-primary);
    width: 24px;
    text-align: center;
}
.quick-link:hover i {
    color: white;
}
.quick-link span {
    font-weight: 600;
    flex: 1;
}
.quick-link small {
    color: var(--portal-text-light);
    font-size: 0.8rem;
}
.quick-link:hover small {
    color: rgba(255, 255, 255, 0.8);
}

/* === 8. LISTS === */
.list-unified {
    background: var(--portal-card-bg);
}
.list-item-unified {
    padding: 1rem 0;
    border-bottom: 1px solid var(--portal-border);
    transition: all 0.2s ease;
}
.list-item-unified:last-child {
    border-bottom: none;
}
.list-item-unified:hover {
    background: rgba(99, 102, 241, 0.02);
    padding-left: 0.5rem;
    border-left: 3px solid var(--portal-primary);
}

/* === 9. BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}
.btn-primary { 
    background: var(--portal-primary); 
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { 
    background: #5856eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
    text-decoration: none;
    color: white;
}

.btn-secondary-unified, .btn-sm {
    background: var(--portal-bg);
    color: var(--portal-text);
    border: 1px solid var(--portal-border);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}
.btn-secondary-unified:hover {
    background: var(--portal-text);
    color: white;
    text-decoration: none;
}

/* === 10. EMPTY STATES === */
.empty-state-mini {
    text-align: center;
    padding: 2rem;
    color: var(--portal-text-light);
}
.empty-state-mini i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--portal-border);
}
.empty-state-mini h3 {
    margin-bottom: 0.5rem;
    color: var(--portal-text);
}

/* === 11. ALERTS === */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.alert-success { 
    background: rgba(16, 185, 129, 0.1); 
    color: var(--success); 
    border-left-color: var(--success);
}
.alert-danger { 
    background: rgba(239, 68, 68, 0.1); 
    color: var(--danger); 
    border-left-color: var(--danger);
}
.alert i {
    font-size: 1.2rem;
}

/* === 12. FORM ELEMENTS === */
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--portal-border);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}
.form-control:focus {
    outline: none;
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* === 13. RESPONSIVE === */
@media (max-width: 1024px) {
    .portal-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    .portal-main {
        margin-left: 0;
        padding: 0;
        max-width: 100vw;
    }
    .content-grid-unified {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 640px) {
    .portal-main {
        padding: 0.75rem;
    }
    .portal-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    .page-header h1 {
        font-size: 2rem;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .service-detail {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}
