/* ===== GLOBAL MODERN THEME ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --card-hover-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ===== NAVBAR STYLING ===== */
.navbar {
    background: var(--primary-gradient) !important;
    box-shadow: 0 2px 15px rgba(102, 126, 234, 0.3);
    border: none;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.navbar .nav-link {
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: var(--border-radius-sm);
    margin: 0 2px;
}

.navbar .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.navbar .dropdown-menu {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 8px;
}

.navbar .dropdown-item {
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.navbar .dropdown-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

/* ===== CARD STYLING ===== */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

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

.card-header {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    font-weight: 600;
    padding: 12px 16px;
}

.card-header.bg-primary {
    background: var(--primary-gradient) !important;
    border: none;
}

.card-body {
    padding: 20px;
}

/* ===== BUTTON STYLING ===== */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.2s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: var(--primary-gradient);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.btn-success {
    background: var(--success-gradient);
}

.btn-danger {
    background: var(--danger-gradient);
}

.btn-warning {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #333;
}

.btn-info {
    background: var(--info-gradient);
    color: #fff;
}

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

.btn-outline-primary:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #fff;
}

/* ===== FORM STYLING ===== */
.form-control, .form-select {
    border-radius: var(--border-radius-sm);
    border: 1.5px solid #e0e5ec;
    padding: 10px 14px;
    transition: all 0.2s ease;
    background: #fafbfc;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: #fff;
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 6px;
}

.input-group-text {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

/* ===== TABLE STYLING ===== */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table th {
    white-space: nowrap;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    font-weight: 600;
    color: #495057;
    border: none;
    padding: 12px 16px;
}

.table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-color: rgba(102, 126, 234, 0.08);
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.table-responsive {
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

/* ===== BADGE STYLING ===== */
.badge {
    font-size: 0.85em;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 20px;
}

.badge.bg-primary {
    background: var(--primary-gradient) !important;
}

.badge.bg-success {
    background: var(--success-gradient) !important;
}

.badge.bg-danger {
    background: var(--danger-gradient) !important;
}

/* ===== ALERT STYLING ===== */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.alert-success {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.1), rgba(56, 239, 125, 0.1));
    color: #0f5132;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(235, 51, 73, 0.1), rgba(244, 92, 67, 0.1));
    color: #842029;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(246, 211, 101, 0.2), rgba(253, 160, 133, 0.2));
    color: #664d03;
}

.alert-info {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.1), rgba(0, 242, 254, 0.1));
    color: #055160;
}

/* ===== MISCELLANEOUS ===== */
.btn-remove:first-child:last-child {
    opacity: 0.5;
    pointer-events: none;
}

.item-row:first-child .btn-remove {
    opacity: 0.5;
}

.item-row:not(:first-child) .btn-remove {
    opacity: 1;
}

footer {
    margin-top: 2rem;
    padding: 1.5rem 0;
    text-align: center;
    color: #6c757d;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

/* ===== MODAL STYLING ===== */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: var(--primary-gradient);
    color: #fff;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border: none;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ===== PAGE TITLE STYLING ===== */
h1, h2, h3, h4, h5 {
    font-weight: 600;
    color: #2d3748;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4190);
}

/* Riserva table alternating colors */
.table-riserva tbody tr:nth-child(odd) {
    background-color: #fff8e1;
}
.table-riserva tbody tr:nth-child(even) {
    background-color: #fffde7;
}
.table-riserva tbody tr:hover {
    background-color: #ffecb3 !important;
}

/* Esposizione table alternating colors */
.table-esposizione tbody tr:nth-child(odd) {
    background-color: #e3f2fd;
}
.table-esposizione tbody tr:nth-child(even) {
    background-color: #e8f4fd;
}
.table-esposizione tbody tr:hover {
    background-color: #bbdefb !important;
}

/* Pannello Saldi Styling */
.pannello-saldi-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pannello-saldi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25) !important;
}

.pannello-saldi-card .card-header {
    border-radius: 16px 16px 0 0;
    padding: 12px 16px;
    border: none;
}

.pannello-saldi-card .card-header h6 {
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.pannello-saldi-card .saldo-input {
    border-radius: 8px;
    border: 1.5px solid #e0e0e0;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    background: #fafbfc;
}

.pannello-saldi-card .saldo-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: #fff;
}

.pannello-saldi-card .input-group-text {
    border-radius: 8px 0 0 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    border: none;
}

.pannello-saldi-card hr {
    border-color: #e8e8ff;
    opacity: 0.5;
}

.pannello-saldi-card #grand_total {
    font-size: 1.1rem;
    padding: 4px 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

/* Pannello Custom Styling */
.pannello-custom-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pannello-custom-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.25) !important;
}

.pannello-custom-card .card-header {
    border-radius: 16px 16px 0 0;
    padding: 12px 16px;
    border: none;
}

.pannello-custom-card .card-header span {
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.pannello-custom-card .pannello-item:hover {
    background: rgba(240, 147, 251, 0.12) !important;
}

.pannello-custom-card hr {
    border-color: #fce4ec;
    opacity: 0.5;
}
