/**
 * MOD4 Web Analyzer - Styles
 * 
 * Stili per frontend e backend del plugin MOD4 Analyzer
 */

/* === VARIABILI === */
:root {
    --mod4-primary: #0073aa;
    --mod4-secondary: #23282d;
    --mod4-success: #46b450;
    --mod4-warning: #ffb900;
    --mod4-error: #dc3232;
    --mod4-border: #ddd;
    --mod4-bg-light: #f9f9f9;
    --mod4-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* === CONTAINER PRINCIPALE === */
.mod4-editor-container,
.mod4-upload-container {
    max-width: 1400px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
    box-shadow: var(--mod4-shadow);
    border-radius: 4px;
}

/* === HEADER === */
.mod4-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--mod4-border);
    flex-wrap: wrap;
}

.mod4-header h2 {
    margin: 0;
    color: var(--mod4-secondary);
}
.mod4-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    justify-content: end;
}
.mod4-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

/* === SELETTORI === */
.mod4-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mod4-selector label {
    font-weight: 600;
    margin: 0;
}

.mod4-selector select {
    min-width: 180px;
    padding: 6px 12px;
    border: 1px solid var(--mod4-border);
    border-radius: 3px;
}

/* === BOTTONI === */
.mod4-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.mod4-btn-primary {
    background: var(--mod4-primary);
    color: #fff;
}

.mod4-btn-primary:hover {
    background: #005177;
}

.mod4-btn-secondary {
    background: var(--mod4-secondary);
    color: #fff;
}

.mod4-btn-secondary:hover {
    background: #191e23;
}

.mod4-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === STATISTICHE === */
.mod4-stats-section {
    margin-bottom: 25px;
    background: #fff;
    border: 1px solid var(--mod4-border);
    border-radius: 4px;
    overflow: hidden;
}

.mod4-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--mod4-bg-light);
    border-bottom: 1px solid var(--mod4-border);
    cursor: pointer;
    transition: background 0.2s;
}

.mod4-stats-header:hover {
    background: #f0f0f0;
}

.mod4-stats-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--mod4-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mod4-stats-header h3 .dashicons {
    color: var(--mod4-primary);
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.mod4-stats-toggle {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: var(--mod4-secondary);
    transition: transform 0.3s ease;
}

.mod4-stats-toggle .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.mod4-stats-toggle.expanded {
    transform: rotate(180deg);
}

.mod4-stats-content {
    padding: 20px;
}

.mod4-stats {
    margin: 0;
}

.mod4-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.mod4-stat-box {
    background: var(--mod4-bg-light);
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid var(--mod4-primary);
}

.mod4-stat-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.mod4-stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: var(--mod4-secondary);
}

/* === FILTRI TABELLA === */
.mod4-table-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--mod4-bg-light);
    border-radius: 4px;
    border: 1px solid var(--mod4-border);
    flex-wrap: wrap;
    align-items: flex-end;
}

.mod4-filter-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mod4-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--mod4-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.mod4-filter-group label .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.mod4-filter-input {
    padding: 8px 12px;
    border: 1px solid var(--mod4-border);
    border-radius: 3px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.mod4-filter-input:focus {
    outline: none;
    border-color: var(--mod4-primary);
    box-shadow: 0 0 0 1px var(--mod4-primary);
}

.mod4-filter-reset {
    align-self: flex-end;
    white-space: nowrap;
}

.mod4-filter-reset .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 4px;
}

/* === TABELLA === */
.mod4-data-table {
    overflow-x: auto;
    margin-bottom: 20px;
}

.mod4-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.mod4-table thead {
    background: var(--mod4-secondary);
    color: #fff;
}

.mod4-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.mod4-table th.mod4-number {
    text-align: right;
}

.mod4-table tbody tr {
    border-bottom: 1px solid var(--mod4-border);
    transition: background 0.2s;
}

.mod4-table tbody tr:hover {
    /*background: #f9f9f9;*/
}

.mod4-table td {
    padding: 10px 12px;
    font-size: 13px;
}

.mod4-table td.mod4-number {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.mod4-table td.mod4-codice {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* === LIVELLI GERARCHICI === */
.mod4-row.mod4-level-1 {
    background: #e8f4f8;
    font-weight: 700;
}

.mod4-row.mod4-level-2 {
    background: #f0f8fc;
    font-weight: 600;
}

.mod4-row.mod4-level-3 {
    background: #f5fbfd;
    font-weight: 500;
}

.mod4-row.mod4-level-4,
.mod4-row.mod4-level-5 {
    background: #fff;
}

.mod4-row-updated {
    background: #e7f7e7 !important;
    animation: highlight 2s;
}

.mod4-row-parent-updated {
    background: #fff3cd !important;
    animation: highlightParent 1.5s;
}

@keyframes highlight {
    0% { background: #90ee90; }
    100% { background: inherit; }
}

@keyframes highlightParent {
    0% { background: #ffc107; }
    100% { background: inherit; }
}

/* === INPUT RETTIFICA === */
.mod4-input-rettifica {
    width: 100%;
    max-width: 150px;
    padding: 6px 8px;
    border: 1px solid var(--mod4-border);
    border-radius: 3px;
    text-align: right;
    font-family: 'Courier New', monospace;
    transition: border-color 0.2s;
}

.mod4-input-rettifica:focus {
    outline: none;
    border-color: var(--mod4-primary);
    box-shadow: 0 0 0 1px var(--mod4-primary);
}

/* === TABELLA AD ALBERO === */
.mod4-table-tree .mod4-tree-row.mod4-level-0 {
    background: #e8f4f8;
    font-weight: bold;
}

.mod4-table-tree .mod4-tree-row.mod4-level-1 {
    background: #f0f8fc;
}

.mod4-table-tree .mod4-tree-row.mod4-level-2 {
    background: #f5fbfd;
}

/* === FORM UPLOAD === */
.mod4-form {
    max-width: 600px;
    margin: 0 auto;
}

.mod4-form-group {
    margin-bottom: 20px;
}

.mod4-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--mod4-secondary);
}

.mod4-form-group input[type="text"],
.mod4-form-group input[type="number"],
.mod4-form-group input[type="file"],
.mod4-form-group select,
.mod4-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--mod4-border);
    border-radius: 3px;
    font-size: 14px;
}

.mod4-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.mod4-help-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.mod4-form-actions {
    margin-top: 20px;
}

/* === DOWNLOAD TEMPLATE === */
.mod4-template-download {
    margin-bottom: 30px;
}

.mod4-template-download .mod4-notice {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mod4-template-download .mod4-notice p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mod4-template-download .mod4-notice .dashicons {
    flex-shrink: 0;
}

.mod4-template-download .mod4-btn {
    align-self: flex-start;
}

.mod4-spin {
    animation: mod4Spin 0.8s linear infinite;
}

/* === PROGRESS BAR === */
.mod4-progress {
    margin-top: 20px;
}

.mod4-progress-bar {
    height: 30px;
    background: var(--mod4-bg-light);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.mod4-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--mod4-primary) 25%, transparent 25%, transparent 50%, var(--mod4-primary) 50%, var(--mod4-primary) 75%, transparent 75%);
    background-size: 40px 100%;
    animation: progress-animation 1s linear infinite;
}

@keyframes progress-animation {
    0% { background-position: 0 0; }
    100% { background-position: 40px 0; }
}

.mod4-progress-text {
    text-align: center;
    margin-top: 10px;
    font-weight: 600;
}

/* === NOTICE === */
.mod4-notice {
    padding: 12px 16px;
    border-left: 4px solid;
    margin: 15px 0;
    border-radius: 0 3px 3px 0;
}

.mod4-notice-success {
    background: #ecf7ed;
    border-color: var(--mod4-success);
    color: #0f5132;
}

.mod4-notice-error {
    background: #f8d7da;
    border-color: var(--mod4-error);
    color: #721c24;
}

.mod4-notice-warning {
    background: #fff3cd;
    border-color: var(--mod4-warning);
    color: #856404;
}

.mod4-notice-info {
    background: #d1ecf1;
    border-color: #0dcaf0;
    color: #0c5460;
}

/* === FOOTER === */
.mod4-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--mod4-border);
    text-align: center;
    color: #666;
    font-size: 12px;
}

/* === ADMIN === */
.mod4-admin-header {
    background: var(--mod4-bg-light);
    padding: 15px;
    border-left: 4px solid var(--mod4-primary);
    margin-bottom: 20px;
}

.mod4-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.mod4-status-active {
    background: #ecf7ed;
    color: var(--mod4-success);
}

.mod4-status-inactive {
    background: #f8d7da;
    color: var(--mod4-error);
}

.mod4-action-create-db,
.mod4-action-reset,
.mod4-action-delete-db,
.mod4-action-activate,
.mod4-action-delete-upload {
    margin-right: 5px;
}

/* === STATISTICHE DASHBOARD === */
.mod4-stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.mod4-stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--mod4-shadow);
    border-top: 4px solid var(--mod4-primary);
    text-align: center;
}

.mod4-stat-card h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
}

.mod4-stat-card .mod4-stat-number {
    font-size: 36px;
    font-weight: bold;
    color: var(--mod4-primary);
    margin: 0;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .mod4-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .mod4-controls {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }
    
    .mod4-selector select {
        width: 100%;
    }
    
    .mod4-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .mod4-table {
        font-size: 12px;
    }
    
    .mod4-table th,
    .mod4-table td {
        padding: 8px 6px;
    }
}

/* === ANIMAZIONI === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mod4-notice {
    animation: fadeIn 0.3s;
}

/* === LOADING === */
.mod4-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.1);
    border-radius: 50%;
    border-top-color: var(--mod4-primary);
    animation: spin 1s linear infinite;
}

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

/* === PRINT === */
@media print {
    .mod4-header,
    .mod4-controls,
    .mod4-actions,
    .mod4-footer {
        display: none;
    }
    
    .mod4-table {
        page-break-inside: avoid;
    }
}

/* === MODAL === */
.mod4-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s;
}

.mod4-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: slideDown 0.3s;
}

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

.mod4-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    padding: 10px 20px;
    cursor: pointer;
}

.mod4-modal-close:hover,
.mod4-modal-close:focus {
    color: #000;
}

.mod4-modal .mod4-upload-container {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
}

/* === PULSANTE UPLOAD === */
.mod4-btn-success {
    background: var(--mod4-success);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mod4-btn-success:hover {
    background: #3a9641;
}

.mod4-btn-success .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* === NOTICE BENVENUTO === */
.mod4-notice-info {
    background: #e5f5fa;
    border-left: 4px solid var(--mod4-primary);
    padding: 15px 20px;
    margin-bottom: 20px;
}

.mod4-notice-info h3 {
    margin-top: 0;
    color: var(--mod4-primary);
}

/* === SISTEMA TAB === */
.mod4-tabs-container {
    margin-top: 30px;
}

.mod4-tabs-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 2px solid var(--mod4-border);
    gap: 5px;
}

.mod4-tab-item {
    margin: 0;
}

.mod4-tab-link {
    display: block;
    padding: 12px 24px;
    background: var(--mod4-bg-light);
    border: 1px solid var(--mod4-border);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--mod4-secondary);
    transition: all 0.2s;
    position: relative;
    top: 2px;
}

.mod4-tab-link:hover {
    background: #fff;
    color: var(--mod4-primary);
}

.mod4-tab-link.active {
    background: #fff;
    color: var(--mod4-primary);
    border-bottom: 2px solid #fff;
    top: 2px;
    z-index: 1;
}

.mod4-tabs-content {
    background: #fff;
    border: 1px solid var(--mod4-border);
    border-top: none;
    padding: 20px;
    min-height: 400px;
}

.mod4-tab-pane {
    display: none;
}

.mod4-tab-pane.active {
    display: block;
    animation: mod4FadeIn 0.3s ease-in;
}

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

.mod4-tab-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.mod4-tab-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--mod4-bg-light);
    border-top-color: var(--mod4-primary);
    border-radius: 50%;
    animation: mod4Spin 0.8s linear infinite;
    margin-bottom: 15px;
}

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

.mod4-tab-loading p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

/* Tab content specifici */
.mod4-tab-pane .mod4-data-table {
    margin-top: 0;
}

/* Placeholder tabelle fogli da implementare */
.mod4-placeholder-table {
    margin-top: 20px;
}

.mod4-placeholder-table .mod4-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-style: italic;
}

/* Container fogli specifici */
.mod4-foglio3-container,
.mod4-foglio4-container,
.mod4-foglio5-container {
    padding: 10px 0;
}

.mod4-foglio3-container h3,
.mod4-foglio4-container h3,
.mod4-foglio5-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--mod4-secondary);
}

/* Foglio 3 - Stato Patrimoniale */
.mod4-foglio3-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--mod4-border);
}

.mod4-foglio3-header h3 {
    margin-bottom: 8px;
}

.mod4-foglio3-header .mod4-description {
    color: #666;
    font-size: 14px;
    margin: 0;
}

.mod4-foglio3-sezione {
    margin-bottom: 40px;
}

.mod4-sezione-title {
    background: var(--mod4-bg-light);
    padding: 10px 15px;
    margin: 0 0 15px 0;
    border-left: 4px solid var(--mod4-primary);
    font-size: 16px;
    font-weight: 600;
    color: var(--mod4-secondary);
}

.mod4-foglio3-table {
    margin-bottom: 0;
}

.mod4-foglio3-table .mod4-col-codice {
    width: 150px;
    font-family: 'Courier New', monospace;
}

.mod4-foglio3-table .mod4-col-codice code {
    background: var(--mod4-bg-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: var(--mod4-primary);
}

.mod4-foglio3-table .mod4-col-descrizione {
    min-width: 300px;
}

.mod4-foglio3-table .mod4-col-lorde,
.mod4-foglio3-table .mod4-col-svalutazione,
.mod4-foglio3-table .mod4-col-ammortamento {
    width: 150px;
    font-weight: 600;
}

.mod4-foglio3-table tbody tr:hover {
    background: #f0f8ff;
}

.mod4-foglio3-table td {
    padding: 10px 12px;
}

/* Totali per sezione */
.mod4-foglio3-table tfoot {
    font-weight: 700;
    background: var(--mod4-bg-light);
    border-top: 2px solid var(--mod4-primary);
}

/* Foglio 3 - Selettore Vista */
.mod4-foglio3-title-wrapper,
.mod4-foglio4-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.mod4-foglio3-vista-selector,
.mod4-foglio4-vista-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mod4-foglio5-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--mod4-border);
}

.mod4-btn-vista {
    padding: 8px 16px;
    font-size: 14px;
    background: white;
    border: 1px solid var(--mod4-border);
    color: var(--mod4-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mod4-btn-vista:hover {
    background: var(--mod4-bg-light);
    border-color: var(--mod4-primary);
}

.mod4-btn-vista.active {
    background: var(--mod4-primary);
    color: white;
    border-color: var(--mod4-primary);
    font-weight: 600;
}

/* Foglio 3 - Tabella Riassuntiva */
.mod4-foglio3-riassuntivo {
    margin-top: 20px;
}

.mod4-stato-patrimoniale-parte {
    margin-bottom: 50px;
}

.mod4-parte-title {
    background: var(--mod4-secondary);
    color: white;
    padding: 12px 20px;
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;
}

.mod4-table-riassuntiva {
    width: 100%;
}

.mod4-table-riassuntiva th {
    background: var(--mod4-bg-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.mod4-table-riassuntiva .mod4-col-livello {
    width: 80px;
    text-align: center;
}

.mod4-table-riassuntiva .mod4-col-descrizione {
    min-width: 400px;
}

.mod4-table-riassuntiva .mod4-col-valore {
    width: 180px;
    font-weight: 600;
}

.mod4-table-riassuntiva .mod4-col-codice {
    width: 150px;
    font-family: 'Courier New', monospace;
}

/* Righe speciali */
.mod4-row-sezione td {
    background: #e8f4f8 !important;
    padding: 12px 15px !important;
    font-weight: 700;
    color: var(--mod4-secondary);
    border-top: 2px solid var(--mod4-primary);
    border-bottom: 2px solid var(--mod4-primary);
}

.mod4-row-totale {
    background: #fff9e6 !important;
    border-top: 2px solid #f0ad4e;
}

.mod4-row-totale td {
    padding: 10px 15px !important;
    font-weight: 700 !important;
}

.mod4-row-totale-generale {
    background: #e6f3ff !important;
    border-top: 3px solid var(--mod4-primary);
    border-bottom: 3px solid var(--mod4-primary);
}

.mod4-row-totale-generale td {
    padding: 12px 15px !important;
    font-weight: 700 !important;
    font-size: 16px;
}

/* Indentazione gerarchica */
.mod4-indent-0 {
    font-weight: 600;
}

.mod4-indent-1 td:nth-child(2) {
    padding-left: 35px !important;
}

.mod4-indent-2 td:nth-child(2) {
    padding-left: 55px !important;
    font-size: 14px;
}

.mod4-indent-3 td:nth-child(2) {
    padding-left: 75px !important;
    font-size: 13px;
    color: #666;
}

/* Hover effect */
.mod4-table-riassuntiva tbody tr:not(.mod4-row-sezione):not(.mod4-row-totale):not(.mod4-row-totale-generale):hover {
    background: #f8f9fa;
}

/* ========================================
   FOGLIO 4 - Dettagli Beni Concessione/Leasing
   ======================================== */

.mod4-foglio4-container {
    padding: 10px 0;
}

.mod4-foglio4-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--mod4-border);
}

.mod4-foglio4-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.mod4-foglio4-header h3 {
    margin-top: 0;
    margin-bottom: 0;
    color: var(--mod4-secondary);
}

.mod4-foglio4-header .mod4-description {
    color: #666;
    font-size: 14px;
    margin: 0;
}

.mod4-foglio4-vista-selector {
    display: flex;
    gap: 10px;
}

.mod4-foglio4-sezione {
    margin-bottom: 40px;
}

.mod4-foglio4-table {
    margin-bottom: 0;
}

.mod4-foglio4-table .mod4-col-codice {
    width: 150px;
    font-family: 'Courier New', monospace;
}

.mod4-foglio4-table .mod4-col-codice code {
    background: var(--mod4-bg-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: var(--mod4-primary);
}

.mod4-foglio4-table .mod4-col-descrizione {
    min-width: 300px;
}

.mod4-foglio4-table .mod4-col-lorde,
.mod4-foglio4-table .mod4-col-svalutazione,
.mod4-foglio4-table .mod4-col-ammortamento {
    width: 150px;
    font-weight: 600;
}

.mod4-foglio4-table tbody tr:hover {
    background: #f0f8ff;
}

.mod4-foglio4-table td {
    padding: 10px 12px;
}

.mod4-foglio4-riassuntivo {
    margin-top: 20px;
}

/* === FOGLIO 5 - CONTO ECONOMICO === */
.mod4-foglio5-container {
    margin-top: 20px;
}

.mod4-foglio5-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--mod4-border);
}

.mod4-foglio5-header h3 {
    margin: 0 0 10px 0;
    color: var(--mod4-secondary);
    font-size: 24px;
}

.mod4-foglio5-header .mod4-description {
    color: #666;
    margin: 5px 0 0 0;
    font-size: 14px;
}

.mod4-conto-economico {
    margin-top: 20px;
}

.mod4-table-conto-economico {
    width: 100%;
    border-collapse: collapse;
}

.mod4-table-conto-economico .mod4-col-livello {
    width: 80px;
    text-align: center;
}

.mod4-table-conto-economico .mod4-col-descrizione {
    width: auto;
    min-width: 400px;
}

.mod4-table-conto-economico .mod4-col-valore {
    width: 200px;
    text-align: right;
}

.mod4-table-conto-economico .mod4-col-codice {
    width: 120px;
    text-align: center;
}

.mod4-table-conto-economico .mod4-col-codice code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    color: #666;
}

/* Row types per Conto Economico */
.mod4-row-sezione {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: white;
    font-weight: bold;
}

.mod4-row-sezione td {
    padding: 12px 15px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mod4-row-subtotale {
    background: #f0f8ff;
    border-top: 1px solid #cce5ff;
    border-bottom: 1px solid #cce5ff;
}

.mod4-row-subtotale td {
    padding: 10px 15px;
    font-style: italic;
    color: #005177;
}

.mod4-row-totale {
    background: #e6f3ff;
    border-top: 2px solid #0073aa;
    border-bottom: 2px solid #0073aa;
}

.mod4-row-totale td {
    padding: 12px 15px;
    font-weight: bold;
    font-size: 15px;
}

.mod4-row-totale-calcolato {
    background: linear-gradient(135deg, #46b450 0%, #2e7d32 100%);
    color: white;
    border-top: 3px solid #1e5a1e;
    border-bottom: 3px solid #1e5a1e;
}

.mod4-row-totale-calcolato td {
    padding: 15px;
    font-weight: bold;
    font-size: 16px;
}

/* Indentation per voci nidificate */
.mod4-indent-1 td:nth-child(2) {
    padding-left: 30px !important;
}

.mod4-indent-2 td:nth-child(2) {
    padding-left: 60px !important;
}

.mod4-indent-3 td:nth-child(2) {
    padding-left: 90px !important;
}

/* Hover per righe normali */
.mod4-table-conto-economico tbody tr:not(.mod4-row-sezione):not(.mod4-row-subtotale):not(.mod4-row-totale):not(.mod4-row-totale-calcolato):hover {
    background: #f9f9f9;
}

/* === XBRL ACTIONS - FOGLI 2, 3, 4 === */
.mod4-foglio2-header,
.mod4-foglio3-title-wrapper,
.mod4-foglio4-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
}

.mod4-foglio3-controls,
.mod4-foglio4-controls {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.mod4-foglio2-actions,
.mod4-foglio3-actions,
.mod4-foglio4-actions,
.mod4-foglio5-actions {
    display: flex;
    gap: 8px;
}

.mod4-generate-xbrl {
    white-space: nowrap;
}

/* Responsive per header fogli */
@media (max-width: 768px) {
    .mod4-foglio2-header,
    .mod4-foglio3-title-wrapper,
    .mod4-foglio4-title-wrapper {
        flex-direction: column;
    }
    
    .mod4-foglio3-controls,
    .mod4-foglio4-controls {
        width: 100%;
        flex-direction: column;
    }
    
    .mod4-foglio3-vista-selector,
    .mod4-foglio4-vista-selector {
        width: 100%;
    }
}

