* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    margin: 0;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.alert {
    padding: 12px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-weight: 500;
}

.alert-success { background: #d4edda; color: #155724; }
.alert-danger { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-info { background: #d1ecf1; color: #0c5460; }

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #1f1f1f;
    color: white;
    width: 100%;
}

.btn-secondary {
    background: #1f1f1f;
    color: white;
}

.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 180px;
    background: #1f1f1f;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.sidebar-header {
    padding: 20px;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    color: #ecf0f1;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.menu-section {
    margin-bottom: 20px;
}

.menu-section-title {
    padding: 10px 20px;
    font-size: 11px;
    text-transform: uppercase;
    color: #7b7b7b;
    font-weight: 600;
    letter-spacing: 1px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: #2a2a2a;
    border-left-color: #2a74ff;
}

.nav-link.active {
    background: #2a2a2a;
    border-left-color: #2a74ff;
    color: #2a74ff;
}

.nav-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #2a2a2a;
    background: #1a1a1a;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #ecf0f1;
}

.user-role {
    font-size: 12px;
    color: #95a5a6;
}

.main-content {
    flex: 1;
    margin-left: 180px;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: white;
    padding: 12px 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h1 {
    margin: 0;
    padding-left: 0;
    font-size: 20px;
    color: #2c3e50;
}

.dashboard-content {
    padding: 15px 15px 15px 15px;
    flex: 1;
    max-width: 100%;
    box-sizing: border-box;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 11px;
}

.data-table th, .data-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
    min-width: 70px;
}

.data-table th {
    background: #1f1f1f;
    color: #ffffff;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.data-table tfoot td {
    background: #f8f9fa;
    font-weight: 700;
    border-top: 2px solid #1f1f1f;
    border-bottom: 2px solid #1f1f1f;
}

.data-table tbody tr.row-with-data-partenza {
    background-color: #FFFFE0;
}

.data-table tbody tr.row-with-data-partenza:hover {
    background-color: #FFFACD;
}

.config-container {
    max-width: 900px;
    margin: 0 auto;
}

.config-form {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.config-form h2 {
    margin-bottom: 20px;
    color: #333;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 12px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-test {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    background: #1f1f1f;
    color: white;
}

.btn-test:hover {
    background: #000;
}

.test-result {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.test-result h3 {
    margin-bottom: 15px;
}

.connection-logs {
    margin-top: 30px;
}

.connection-logs h3 {
    margin-bottom: 15px;
}

.status-success {
    color: #28a745;
    font-weight: 600;
}

.status-error {
    color: #dc3545;
    font-weight: 600;
}

.log-success {
    background: #f0f9f4;
}

.log-error {
    background: #fef5f5;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-refresh, .btn-export {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    background: #1f1f1f;
    color: white;
    transition: background 0.3s;
}

.btn-refresh:hover, .btn-export:hover {
    background: #000;
}

.orders-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: flex-start;
}

.stat-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #7f8c8d;
}

.table-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: flex-start;
}

.table-controls input,
.table-controls select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.table-controls input {
    flex: 1;
    max-width: 400px;
}

.table-container {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
}

.table-footer {
    margin-top: 15px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    text-align: right;
    font-size: 14px;
    color: #7f8c8d;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.empty-state p {
    color: #7f8c8d;
}

.translations-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.translation-row {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.column-name {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 16px;
}

.translation-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.language-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.tab-btn:hover {
    border-color: #3498db;
}

.tab-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.preview-table {
    overflow-x: auto;
}

.lang-selector {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    resize: vertical;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-manager {
    background: #e74c3c;
    color: white;
}

.badge-agente {
    background: #3498db;
    color: white;
}

.badge-cliente {
    background: #2ecc71;
    color: white;
}

.badge-utente_interno {
    background: #f39c12;
    color: white;
}

.badge-operatore_ordini {
    background: #9b59b6;
    color: white;
}

.status-enabled {
    color: #2ecc71;
    font-weight: 600;
}

.status-disabled {
    color: #e74c3c;
    font-weight: 600;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.2);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #f9f9f9;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

/* ========================================
   RESPONSIVE DESIGN - Media Queries
   ======================================== */

/* Tablet e dispositivi medi (max-width: 1024px) */
@media screen and (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .dashboard-header h1 {
        font-size: 20px;
    }
    
    .translation-inputs {
        grid-template-columns: 1fr;
    }
}

/* Tablet piccoli e smartphone landscape (max-width: 768px) */
@media screen and (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
        position: fixed;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
        padding: 15px 20px;
    }
    
    .dashboard-header h1 {
        font-size: 18px;
    }
    
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .btn-refresh, .btn-export, .lang-selector {
        flex: 1;
        min-width: 120px;
    }
    
    .dashboard-content {
        padding: 15px;
    }
    
    .orders-stats {
        flex-direction: column;
    }
    
    .table-controls {
        flex-direction: column;
    }
    
    .table-controls input {
        max-width: 100%;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        font-size: 11px;
    }
    
    .data-table th, .data-table td {
        padding: 6px 8px;
        min-width: 60px;
    }
    
    .config-container {
        padding: 0 15px;
    }
    
    .config-form {
        padding: 20px 15px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 20px;
    }
    
    .login-box {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .container {
        padding: 0;
    }
}

/* Smartphone portrait (max-width: 480px) */
@media screen and (max-width: 480px) {
    .dashboard-header h1 {
        font-size: 16px;
    }
    
    .header-actions {
        flex-direction: column;
    }
    
    .btn-refresh, .btn-export, .lang-selector {
        width: 100%;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .data-table {
        font-size: 10px;
    }
    
    .data-table th, .data-table td {
        padding: 5px 6px;
        min-width: 50px;
    }
    
    .data-table th {
        font-size: 10px;
    }
    
    .sidebar-header h2 {
        font-size: 18px;
    }
    
    .nav-link {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .nav-icon {
        font-size: 16px;
    }
    
    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .user-name {
        font-size: 13px;
    }
    
    .login-box {
        padding: 25px 15px;
    }
    
    .login-box h1 {
        font-size: 22px;
    }
    
    .form-group input,
    .form-group select {
        font-size: 16px; /* Previene zoom automatico su iOS */
    }
    
    .modal-content {
        width: 98%;
        padding: 15px;
    }
    
    .translation-row {
        padding: 15px;
    }
    
    .empty-icon {
        font-size: 48px;
    }
    
    .empty-state h3 {
        font-size: 18px;
    }
    
    .empty-state p {
        font-size: 14px;
    }
}

/* Menu hamburger per mobile */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: #2c3e50;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
}

@media screen and (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .dashboard-header {
        padding-left: 60px;
    }
}

/* Overlay per chiudere menu mobile */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

@media screen and (max-width: 768px) {
    .mobile-overlay.active {
        display: block;
    }
}

/* Miglioramenti touch per dispositivi mobili */
@media (hover: none) and (pointer: coarse) {
    .btn-primary,
    .btn-secondary,
    .btn-refresh,
    .btn-export,
    .btn-test,
    .nav-link {
        min-height: 44px; /* Dimensione minima touch target iOS */
    }
    
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Stampa */
@media print {
    .sidebar,
    .dashboard-header,
    .table-controls,
    .table-footer,
    .btn-primary,
    .btn-secondary,
    .btn-refresh,
    .btn-export,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .dashboard-content {
        padding: 15px;
    }
    
    .data-table {
        font-size: 10px;
    }
    
    .data-table th,
    .data-table td {
        padding: 4px;
    }
}

/* Accessibilità - Riduzione movimento */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (opzionale) */
@media (prefers-color-scheme: dark) {
    /* Puoi aggiungere stili dark mode qui se necessario */
}


/* Footer Aziendale Globale */
.app-footer {
    background: transparent;
    color: #95a5a6;
    padding: 15px 20px;
    text-align: center;
    margin-top: auto;
    font-size: 11px;
}

.app-footer .company-name,
.app-footer .company-info {
    display: inline;
    margin: 0;
    color: #95a5a6;
}

.app-footer .company-name::after,
.app-footer .company-info::after {
    content: " - ";
}

.app-footer .company-info:last-child::after {
    content: "";
}

/* Assicura che il footer stia in fondo */
.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
}

.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.dashboard-content {
    flex: 1;
}

/* Responsive footer */
@media (max-width: 768px) {
    .app-footer {
        padding: 15px 20px;
    }
    
    .app-footer .company-name {
        font-size: 14px;
    }
    
    .app-footer .company-info {
        font-size: 11px;
    }
}

/* News */
.news-folder-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}
.news-folder-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 20px 24px;
    min-width: 140px;
    text-decoration: none;
    color: #333;
    transition: background 0.15s, box-shadow 0.15s;
    cursor: pointer;
}
.news-folder-card:hover {
    background: #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.news-folder-card .folder-icon { font-size: 36px; margin-bottom: 8px; }
.news-folder-card .folder-name { font-size: 13px; font-weight: 600; text-align: center; word-break: break-word; }
.news-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 16px;
}
.news-breadcrumb a { color: #0d6efd; text-decoration: none; }
.news-breadcrumb a:hover { text-decoration: underline; }
.news-breadcrumb .bc-sep { color: #aaa; margin: 0 2px; }
.news-breadcrumb .bc-current { font-weight: 600; color: #333; }
.news-actions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.news-action-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 18px 22px;
    flex: 1;
    min-width: 260px;
}
.news-action-card h3 { margin: 0 0 14px 0; font-size: 15px; }
.news-action-card .form-group { margin-bottom: 10px; }
.news-action-card input[type=text],
.news-action-card input[type=file] {
    width: 100%;
    padding: 7px 8px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 4px;
}
