/* ==================== CSS PROFESSIONALE PER COMMERCIALISTI ==================== */

/* VARIABILI COLORI */
:root {
    /* Palette Principale */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --accent: #d4af37;
    --accent-dark: #b8941f;
    
    /* Neutri */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    /* Semantici */
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #3b82f6;
    --info-bg: #dbeafe;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    
    /* Transizioni */
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* RESET */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== LAYOUT ==================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR MODERNA */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.sidebar-header {
    padding: 2.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    letter-spacing: -0.5px;
}

.sidebar-logo-icon {
    width: 42px;
    height: 42px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.sidebar-nav {
    padding: 1.5rem 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 2rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
    gap: 1rem;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: rgba(255, 255, 255, 0.3);
}

.sidebar-nav-item.active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
}

.sidebar-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent);
    transition: height 0.3s ease;
}

.sidebar-nav-item:hover::before,
.sidebar-nav-item.active::before {
    height: 60%;
}

.sidebar-nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: white;
    margin-bottom: 2px;
}

.user-role {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: 280px;
    background: var(--bg-secondary);
}

.top-bar {
    background: var(--bg-primary);
    padding: 1.75rem 2.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--bg-tertiary);
}

.page-title {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.content-wrapper {
    padding: 2.5rem;
    max-width: 1400px;
}

/* ==================== COMPONENTI ==================== */

/* CARDS MODERNE */
.card {
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: var(--transition-slow);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bg-tertiary);
}

/* STATS CARD PREMIUM */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: var(--primary);
    opacity: 0.05;
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.stat-card.stat-success {
    border-left-color: var(--success);
}

.stat-card.stat-success::before {
    background: var(--success);
}

.stat-card.stat-warning {
    border-left-color: var(--warning);
}

.stat-card.stat-warning::before {
    background: var(--warning);
}

.stat-card.stat-info {
    border-left-color: var(--info);
}

.stat-card.stat-info::before {
    background: var(--info);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -1px;
}

/* FORM MODERNI */
.form-group {
    margin-bottom: 1.75rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.625rem;
    font-size: 0.95rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--bg-tertiary);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

/* BUTTONS PREMIUM */
.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-slow);
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, var(--success) 100%);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* TABELLE MODERNE */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-primary);
}

.table thead {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.table th {
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--bg-tertiary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--bg-tertiary);
    color: var(--text-primary);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* BADGES PREMIUM */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--success-bg);
    color: #065f46;
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400e;
}

.badge-info {
    background: var(--info-bg);
    color: #1e40af;
}

.badge-danger {
    background: var(--danger-bg);
    color: #991b1b;
}

/* ALERT MESSAGES */
.alert {
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: var(--success-bg);
    border-left-color: var(--success);
    color: #065f46;
}

.alert-error {
    background: var(--danger-bg);
    border-left-color: var(--danger);
    color: #991b1b;
}

.alert-warning {
    background: var(--warning-bg);
    border-left-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background: var(--info-bg);
    border-left-color: var(--info);
    color: #1e40af;
}

/* LOADING STATES */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* EMPTY STATES */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.empty-state-text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar-nav-item span,
    .sidebar-logo span,
    .user-details {
        display: none;
    }
    
    .sidebar-header {
        padding: 1.5rem 1rem;
    }
    
    .sidebar-logo-icon {
        margin: 0 auto;
    }
    
    .sidebar-nav-item {
        justify-content: center;
        padding: 1rem;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .content-wrapper {
        padding: 1.5rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* UTILITIES */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }
