/* Stili personalizzati per il Sistema UDI Impianti */

:root {
    --primary-color: #17a2b8;  /* Teal/Ciano come il logo */
    --primary-dark: #138496;
    --primary-light: #5bc0de;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --gradient-primary: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    --gradient-light: linear-gradient(135deg, #5bc0de 0%, #17a2b8 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to bottom, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
}

/* Header/Navbar styling con gradient */
.navbar {
    background: linear-gradient(to right, #ffffff 0%, #f8f9fa 100%) !important;
    border-bottom: 4px solid transparent;
    border-image: var(--gradient-primary);
    border-image-slice: 1;
    min-height: 100px;
    box-shadow: 0 2px 10px rgba(23, 162, 184, 0.15);
}

.navbar-brand {
    flex-grow: 0;
}

.navbar-brand h3 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 1.8rem;
}

.navbar-brand small {
    font-size: 0.95rem;
    color: var(--secondary-color);
}

/* Card styling con effetti */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    background: white;
}

.card:hover {
    box-shadow: 0 10px 30px rgba(23, 162, 184, 0.15);
    transform: translateY(-2px);
}

.card-body {
    padding: 1.5rem;
}

/* Table container fix */
.table-responsive {
    width: 100% !important;
    border-radius: 10px;
    overflow: hidden;
}

.dataTables_wrapper {
    width: 100% !important;
}

.dataTables_scrollBody {
    width: 100% !important;
}

.dataTables_scrollHeadInner,
.dataTables_scrollHeadInner table {
    width: 100% !important;
}

/* Table styling con gradient */
.table-primary {
    background: var(--gradient-primary) !important;
    color: white !important;
}

.table-success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%) !important;
    color: white !important;
}

.table-primary th, .table-success th {
    border-color: var(--primary-dark);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 1rem 0.75rem;
}

#implantsTable, #inventoryTable {
    width: 100% !important;
}

#implantsTable tbody tr, #inventoryTable tbody tr {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

#implantsTable tbody tr:hover, #inventoryTable tbody tr:hover {
    background-color: rgba(23, 162, 184, 0.05) !important;
    transform: translateX(5px);
    border-left: 3px solid var(--primary-color);
    box-shadow: 0 2px 10px rgba(23, 162, 184, 0.1);
}

/* Button styling con animazioni e gradient */
.btn {
    border-radius: 25px;
    padding: 0.5rem 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
}

.btn-primary:hover {
    background: var(--gradient-light);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.4);
}

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

.btn-outline-primary:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.3);
}

.btn-outline-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.3);
}

.btn-outline-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

/* Pulsante principale con effetto pulse */
.btn-lg.shadow-lg {
    background: var(--gradient-primary);
    box-shadow: 0 10px 30px rgba(23, 162, 184, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 10px 30px rgba(23, 162, 184, 0.4);
    }
    50% {
        box-shadow: 0 10px 40px rgba(23, 162, 184, 0.6);
    }
    100% {
        box-shadow: 0 10px 30px rgba(23, 162, 184, 0.4);
    }
}

/* Modal styling con effetti */
.modal-header.bg-primary {
    background: var(--gradient-primary) !important;
}

.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideDown 0.3s ease-out;
}

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

.modal-header {
    border-radius: 15px 15px 0 0;
}

/* Form controls con stile migliorato */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.15);
    transform: translateY(-1px);
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-label i {
    color: var(--primary-color);
    margin-right: 0.25rem;
}

/* Search input con stile migliorato */
#searchInput {
    border-radius: 30px;
    padding-left: 2.5rem;
    background: white;
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
}

#searchInput:focus {
    box-shadow: 0 0 20px rgba(23, 162, 184, 0.2);
    transform: translateY(-2px);
}

.input-group-text {
    background: var(--gradient-primary);
    color: white;
    border-radius: 30px 0 0 30px;
    border: none;
}

/* Action buttons in table */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    margin: 0 0.125rem;
}

.btn-action i {
    font-size: 1rem;
}

/* Toast notifications */
.toast {
    border-radius: 10px;
}

/* DataTable customization con stili migliorati */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
}

.dataTables_wrapper .dataTables_filter {
    display: none;  /* Usiamo la nostra barra di ricerca */
}

.dataTables_wrapper .dataTables_scroll {
    overflow: auto;
}

.page-link {
    color: var(--primary-color);
    border-radius: 20px;
    margin: 0 2px;
    transition: all 0.2s ease;
}

.page-link:hover {
    background: var(--gradient-light);
    color: white;
    transform: translateY(-2px);
}

.page-item.active .page-link {
    background: var(--gradient-primary);
    border: none;
}

/* Switch styling */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Nav tabs styling */
.nav-tabs .nav-link {
    color: var(--primary-color);
    border-radius: 10px 10px 0 0;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.nav-tabs .nav-link.active {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

/* Alert boxes con gradient */
.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #b8e7f5 100%);
    color: #0c5460;
    border-left: 4px solid var(--primary-color);
}

.alert-info img {
    max-width: 100%;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Immagine esempio UDI piccola */
.udi-example-img {
    max-width: 180px;
    width: 100%;
    cursor: zoom-in;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-light);
}

.udi-example-img:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.4);
    border-color: var(--primary-color);
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe8a1 100%);
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

/* Gestione tabella con molte colonne - Compatta */
#implantsTable, #inventoryTable {
    font-size: 0.85rem;
    width: 100% !important;
}

#implantsTable th, #inventoryTable th {
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
    padding: 0.5rem 0.3rem;
    font-size: 0.8rem;
}

#implantsTable td, #inventoryTable td {
    text-align: center;
    vertical-align: middle;
    padding: 0.4rem 0.3rem;
}

/* Allinea a sinistra alcune colonne specifiche */
#implantsTable td:nth-child(2),  /* Paziente */
#inventoryTable td:nth-child(2),  /* Tipo DM */
#inventoryTable td:nth-child(3) { /* Marca */
    text-align: left;
}

/* Testo più piccolo per codici UDI */
.udi-code {
    font-size: 0.75rem;
    font-family: monospace;
}

/* Campo ricerca/scanner combinato */
#searchInput {
    background: linear-gradient(to right, #f8f9fa 0%, #e7f5ff 100%);
    border-color: #17a2b8;
    transition: all 0.3s ease;
}

#searchInput:focus {
    background: #fff;
    border-color: #138496;
    box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.25);
}

#searchInput::placeholder {
    font-size: 0.95rem;
}

/* Badge più piccoli */
.badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
}

/* Pulsanti azioni più compatti */
.btn-action {
    padding: 0.2rem 0.4rem;
    margin: 0 1px;
}

/* Text truncate con ellipsis */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Disabilita completamente lo scroll orizzontale */
.dataTables_wrapper {
    overflow-x: hidden !important;
}

.table-responsive {
    overflow-x: hidden !important;
}

/* Status bar */
.text-muted {
    font-size: 0.9rem;
}

/* Loading spinner */
.spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Badge styling */
.badge {
    padding: 0.35rem 0.65rem;
    font-weight: 500;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar {
        min-height: auto;
    }
    
    .navbar-brand img {
        height: 50px;
    }
    
    .navbar-brand h3 {
        font-size: 1.3rem;
    }
    
    .navbar-brand small {
        font-size: 0.85rem;
    }
    
    .btn {
        font-size: 0.9rem;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .d-flex.gap-2 {
        flex-direction: column;
        gap: 0.5rem !important;
    }
}

/* Print styles */
@media print {
    .btn, .navbar, #searchInput, .input-group, .modal {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

/* Custom scrollbar con gradient */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-light);
}

/* Empty state con animazioni */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInOut 2s infinite;
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.95);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* UDI Code display con stile migliorato */
.udi-code {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 0.3rem 0.5rem;
    border-radius: 5px;
    font-size: 0.9rem;
    border: 1px solid var(--primary-light);
    transition: all 0.2s ease;
}

.udi-code:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(-1px);
}

/* Action buttons con hover migliorato */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    margin: 0 0.125rem;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.btn-action:hover {
    transform: scale(1.15) rotate(5deg);
}

.btn-action i {
    font-size: 1rem;
}

/* Toast notifications con stile migliorato */
.toast {
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-header {
    border-radius: 10px 10px 0 0;
}

/* Badge con gradient */
.badge {
    padding: 0.35rem 0.65rem;
    font-weight: 500;
    border-radius: 20px;
    background: var(--gradient-primary);
}

/* Status bar con animazioni */
.bi-shield-check {
    color: var(--success-color);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}
