/* ===== CREDICHECK UX MIGLIORATO + FULLSCREEN ===== */
:root {
    --credicheck-primary: #1e3a5f;
    --credicheck-accent: #22c55e;
    --credicheck-secondary: #64748b;
    --credicheck-light: #f8fafc;
    --credicheck-white: #ffffff;
    --credicheck-border: #e2e8f0;
    --credicheck-text: #334155;
    --credicheck-text-light: #64748b;
    --credicheck-danger: #ef4444;
    --credicheck-warning: #f59e0b;
    --credicheck-info: #3b82f6;
    --credicheck-purple: #8b5cf6;
    --credicheck-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --credicheck-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --credicheck-radius: 12px;
    --credicheck-radius-sm: 8px;
    --credicheck-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 🚀 NUOVE VARIABILI FULLSCREEN */
    --chat-default-width: 500px;
    --chat-default-height: 700px;
    --chat-fullscreen-duration: 300ms;
    --chat-mobile-width: 95vw;
    --chat-mobile-height: 90vh;
}

/* ===== LAYOUT GENERALE ===== */
.risk-api-search,
.risk-api-usage,
.risk-api-ufficio-camerale {
    max-width: 1200px;
    margin: 40px auto;
    padding: 24px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--credicheck-light);
    min-height: 100vh;
}

/* ===== FORM DI LOGIN ===== */
.risk-api-login {
    max-width: 500px;
    margin: 40px auto;
    padding: 32px;
    background: var(--credicheck-white);
    border-radius: var(--credicheck-radius);
    box-shadow: var(--credicheck-shadow);
    border: 1px solid var(--credicheck-border);
    text-align: center;
}

.risk-api-login > p {
    font-size: 16px;
    color: var(--credicheck-text);
    margin-bottom: 24px;
    line-height: 1.5;
}

.risk-api-login .login-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    padding: 12px 16px;
    border-radius: var(--credicheck-radius-sm);
    border: 1px solid #f87171;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.login-field {
    margin-bottom: 20px;
    text-align: left;
}

.login-field label {
    display: block;
    font-size: 14px;
    color: var(--credicheck-primary);
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.login-field input[type="text"],
.login-field input[type="password"],
.login-field input[type="email"] {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid var(--credicheck-border);
    border-radius: var(--credicheck-radius-sm);
    background: var(--credicheck-white);
    color: var(--credicheck-text);
    transition: var(--credicheck-transition);
    font-family: inherit;
    box-sizing: border-box;
}

.login-field input:focus {
    outline: none;
    border-color: var(--credicheck-accent);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
    transform: scale(1.02);
}

.login-field input:hover {
    border-color: #cbd5e1;
}

.login-buttons {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-top: 32px;
}

.login-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--credicheck-primary) 0%, #0f172a 100%);
    color: white;
    border: none;
    border-radius: var(--credicheck-radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--credicheck-transition);
    box-shadow: var(--credicheck-shadow);
    flex: 1;
    justify-content: center;
    min-height: 56px;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.login-button:active {
    transform: translateY(0);
}

.login-button .icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.register-link {
    color: var(--credicheck-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--credicheck-radius-sm);
    transition: var(--credicheck-transition);
    white-space: nowrap;
}

.register-link:hover {
    color: var(--credicheck-accent);
    background: rgba(34, 197, 94, 0.1);
    transform: translateY(-1px);
}

/* ===== TITOLI E TIPOGRAFIA ===== */
h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 32px;
    font-weight: 700;
    color: var(--credicheck-primary);
    margin-bottom: 32px;
    letter-spacing: -0.025em;
}

/* Centratura titoli quando l'utente non è loggato */
.risk-api-search h3,
.risk-api-usage h3 {
    justify-content: center;
    text-align: center;
}

h3 .icon {
    background: var(--credicheck-accent);
    color: white;
    padding: 8px;
    border-radius: var(--credicheck-radius-sm);
    box-shadow: var(--credicheck-shadow);
}

/* ===== STATUS UTENTE ===== */
.user-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--credicheck-white) 0%, #f1f5f9 100%);
    padding: 20px 24px;
    border-radius: var(--credicheck-radius);
    margin-bottom: 32px;
    border: 1px solid var(--credicheck-border);
    box-shadow: var(--credicheck-shadow);
}

.user-status p {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--credicheck-text);
}

.logout-button {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--credicheck-danger);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--credicheck-radius-sm);
    transition: var(--credicheck-transition);
    border: 1px solid transparent;
}

.logout-button:hover {
    background: #fef2f2;
    border-color: #fecaca;
    transform: translateY(-1px);
}

/* ===== FORM DI RICERCA ===== */
.search-container {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    margin-bottom: 32px;
    background: var(--credicheck-white);
    padding: 24px;
    border-radius: var(--credicheck-radius);
    box-shadow: var(--credicheck-shadow);
    border: 1px solid var(--credicheck-border);
}

#partita_iva {
    position: relative;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid var(--credicheck-border);
    border-radius: var(--credicheck-radius-sm);
    background: var(--credicheck-white);
    color: var(--credicheck-text);
    transition: var(--credicheck-transition);
    font-weight: 500;
}

#partita_iva:focus {
    outline: none;
    border-color: var(--credicheck-accent);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
    transform: scale(1.02);
}

#partita_iva.loading {
    background: linear-gradient(90deg, #f8fafc 25%, #e2e8f0 50%, #f8fafc 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

#partita_iva.valid {
    border-color: var(--credicheck-accent);
    background: #f0fdf4;
}

#partita_iva.invalid {
    border-color: var(--credicheck-danger);
    background: #fef2f2;
}

#api_version {
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid var(--credicheck-border);
    border-radius: var(--credicheck-radius-sm);
    background: var(--credicheck-white);
    color: var(--credicheck-text);
    font-weight: 500;
    min-width: 180px;
    cursor: pointer;
    transition: var(--credicheck-transition);
}

#api_version:focus {
    outline: none;
    border-color: var(--credicheck-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

#search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--credicheck-accent) 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: var(--credicheck-radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--credicheck-transition);
    box-shadow: var(--credicheck-shadow);
    position: relative;
    overflow: hidden;
}

#search-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--credicheck-shadow-lg);
}

#search-btn:active {
    transform: translateY(0);
}

#search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

#search-btn.loading {
    background: var(--credicheck-secondary);
    pointer-events: none;
}

#search-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== RISULTATI RICERCA ===== */
.results {
    background: var(--credicheck-white);
    border-radius: var(--credicheck-radius);
    box-shadow: var(--credicheck-shadow-lg);
    border: 1px solid var(--credicheck-border);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--credicheck-transition);
}

.results.show {
    opacity: 1;
    transform: translateY(0);
}

.results.loading {
    background: linear-gradient(90deg, #f8fafc 25%, #e2e8f0 50%, #f8fafc 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results h4 {
    font-size: 24px;
    font-weight: 700;
    color: var(--credicheck-primary);
    margin: 0;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--credicheck-border);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.results .section {
    padding: 24px;
    border-bottom: 1px solid var(--credicheck-border);
}

.results .section:last-child {
    border-bottom: none;
}

.results .section h5 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--credicheck-primary);
    margin: 0 0 16px 0;
}

.results .section h5::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--credicheck-accent);
    border-radius: 2px;
}

.results .section p {
    font-size: 15px;
    color: var(--credicheck-text);
    margin: 8px 0;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.results .section p strong {
    color: var(--credicheck-primary);
    font-weight: 600;
}
/* ===== INDICATORI RISCHIO ===== */
.risk-positive {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
    padding: 12px 16px;
    border-radius: var(--credicheck-radius-sm);
    font-weight: 600;
    border: 1px solid #86efac;
}

.risk-negative {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    padding: 12px 16px;
    border-radius: var(--credicheck-radius-sm);
    font-weight: 600;
    border: 1px solid #f87171;
}

.risk-neutral {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    color: #d97706;
    padding: 12px 16px;
    border-radius: var(--credicheck-radius-sm);
    font-weight: 600;
    border: 1px solid #fbbf24;
}

.risk-icon {
    font-size: 18px;
    margin-right: 8px;
}

/* ===== MESSAGGI UPGRADE ===== */
.upgrade-message {
    background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 100%);
    padding: 24px;
    border-radius: var(--credicheck-radius);
    margin-top: 24px;
    text-align: center;
    border: 1px solid #81d4fa;
    position: relative;
    overflow: hidden;
}

.upgrade-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--credicheck-primary) 0%, var(--credicheck-accent) 100%);
}

.upgrade-message h5 {
    font-size: 20px;
    font-weight: 700;
    color: var(--credicheck-primary);
    margin: 0 0 12px 0;
}

.upgrade-message p {
    font-size: 16px;
    color: var(--credicheck-text);
    margin: 0 0 16px 0;
}

.upgrade-message ul {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    text-align: left;
    display: inline-block;
}

.upgrade-message ul li {
    position: relative;
    padding: 8px 0 8px 24px;
    color: var(--credicheck-text);
    font-weight: 500;
}

.upgrade-message ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--credicheck-accent);
    font-weight: bold;
}

.upgrade-btn {
    background: linear-gradient(135deg, var(--credicheck-primary) 0%, #0f172a 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: var(--credicheck-radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--credicheck-transition);
    box-shadow: var(--credicheck-shadow);
}

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

/* ===== PAGINA UTILIZZO ===== */
.usage-section {
    background: var(--credicheck-white);
    padding: 24px;
    border-radius: var(--credicheck-radius);
    box-shadow: var(--credicheck-shadow);
    margin-bottom: 24px;
    border: 1px solid var(--credicheck-border);
    transition: var(--credicheck-transition);
}

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

.usage-section h4 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    color: var(--credicheck-primary);
    margin: 0 0 16px 0;
}

.usage-section h4 .icon {
    background: var(--credicheck-accent);
    color: white;
    padding: 8px;
    border-radius: var(--credicheck-radius-sm);
}

.usage-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--credicheck-radius-sm);
    overflow: hidden;
    box-shadow: var(--credicheck-shadow);
}

.usage-table th {
    background: linear-gradient(135deg, var(--credicheck-primary) 0%, #0f172a 100%);
    color: white;
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.usage-table td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--credicheck-border);
    color: var(--credicheck-text);
    background: var(--credicheck-white);
    transition: var(--credicheck-transition);
}

.usage-table tr:hover td {
    background: var(--credicheck-light);
}

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

/* ===== PULSANTI AZIONI ===== */
.view-details,
.delete-search,
.monitor-partita-iva-btn,
.request-document-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--credicheck-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--credicheck-transition);
    margin: 4px;
    text-decoration: none;
}

.view-details {
    background: linear-gradient(135deg, var(--credicheck-primary) 0%, #0f172a 100%);
    color: white;
    box-shadow: var(--credicheck-shadow);
}

.view-details:hover {
    transform: translateY(-1px);
    box-shadow: var(--credicheck-shadow-lg);
}

.delete-search {
    background: linear-gradient(135deg, var(--credicheck-danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: var(--credicheck-shadow);
}

.delete-search:hover {
    transform: translateY(-1px);
    box-shadow: var(--credicheck-shadow-lg);
}

.monitor-partita-iva-btn,
.request-document-btn {
    background: linear-gradient(135deg, var(--credicheck-accent) 0%, #16a34a 100%);
    color: white;
    box-shadow: var(--credicheck-shadow);
}

.monitor-partita-iva-btn:hover,
.request-document-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--credicheck-shadow-lg);
}

/* ===== 🎯 NUOVI STILI PER LE AZIONI AGGIORNATE ===== */
/* Stili per le nuove azioni nei dettagli ricerca */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 24px;
    background: #fafafa;
}

.action-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--credicheck-white);
    border-radius: var(--credicheck-radius);
    border: 1px solid var(--credicheck-border);
    transition: var(--credicheck-transition);
    position: relative;
    overflow: hidden;
}

.action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: all 0.3s ease;
}

.action-card:hover {
    background: var(--credicheck-light);
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: var(--credicheck-shadow-lg);
}

.action-card:hover::before {
    background: linear-gradient(90deg, var(--credicheck-info) 0%, var(--credicheck-accent) 100%);
}

.action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--credicheck-radius);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.action-icon.monitor {
    background: linear-gradient(135deg, var(--credicheck-info) 0%, #1d4ed8 100%);
    color: var(--credicheck-white);
}

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

.action-icon.company-full {
    background: linear-gradient(135deg, var(--credicheck-purple) 0%, #7c3aed 100%);
    color: var(--credicheck-white);
}

.action-content {
    flex: 1;
}

.action-content h6 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--credicheck-primary);
}

.action-content p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--credicheck-text-light);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--credicheck-primary) 0%, #0f172a 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--credicheck-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--credicheck-transition);
    text-decoration: none;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
    color: white;
    text-decoration: none;
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.active {
    background: #dcfce7;
    color: #15803d;
}

/* Stili per la sezione risultati con nuove azioni */
.credicheck-results-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 20px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--credicheck-radius);
    border: 1px solid var(--credicheck-border);
}

.partita-iva-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.piva-label {
    font-size: 14px;
    color: var(--credicheck-text-light);
    font-weight: 500;
}

.piva-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--credicheck-primary);
    font-family: 'JetBrains Mono', monospace;
}

.copy-piva-btn {
    background: none;
    border: 1px solid var(--credicheck-border);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--credicheck-text-light);
    transition: all 0.2s;
}

.copy-piva-btn:hover {
    background: #f1f5f9;
    color: var(--credicheck-primary);
}

.api-version-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.api-version-start {
    background: linear-gradient(135deg, var(--credicheck-accent) 0%, #16a34a 100%);
    color: white;
}

.api-version-advanced {
    background: linear-gradient(135deg, var(--credicheck-info) 0%, #1d4ed8 100%);
    color: white;
}

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

.results-section {
    background: white;
    border-radius: var(--credicheck-radius);
    border: 1px solid var(--credicheck-border);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--credicheck-primary) 0%, #0f172a 100%);
    color: white;
}

.section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--credicheck-radius-sm);
}

.section-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

/* ===== CHAT CREDY + FULLSCREEN MIGLIORATO ===== */
.credy-chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
}

#credy-toggle {
    background: linear-gradient(135deg, var(--credicheck-accent) 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--credicheck-shadow-lg);
    transition: var(--credicheck-transition);
    position: relative;
    overflow: hidden;
}

#credy-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

#credy-toggle:hover::before {
    left: 100%;
}

#credy-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 🚀 CHAT WINDOW MIGLIORATA CON FULLSCREEN */
.chat-window {
    display: none;
    width: var(--chat-default-width);
    height: var(--chat-default-height);
    background: var(--credicheck-white);
    border-radius: var(--credicheck-radius);
    box-shadow: var(--credicheck-shadow-lg);
    position: absolute;
    bottom: 80px;
    right: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--credicheck-border);
    transition: all var(--chat-fullscreen-duration) cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.chat-open {
    display: flex;
}

/* 🚀 FULLSCREEN MODE */
.chat-window.chat-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    z-index: 10001 !important;
    box-shadow: none !important;
}

/* Previeni scroll del body quando in fullscreen */
body.credy-fullscreen-active {
    overflow: hidden !important;
}

.chat-header {
    background: linear-gradient(135deg, var(--credicheck-primary) 0%, #0f172a 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.chat-header h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header h4::before {
    content: '🧠';
    font-size: 20px;
}

/* 🚀 CHAT HEADER ACTIONS CON FULLSCREEN */
.chat-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--credicheck-radius-sm);
    transition: var(--credicheck-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* 🚀 PULSANTE FULLSCREEN STILIZZATO */
#credy-fullscreen {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#credy-fullscreen:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

#credy-fullscreen svg {
    width: 20px;
    height: 20px;
}

/* 🚀 MESSAGES AREA CON SCROLL INTELLIGENTE */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: calc(var(--chat-default-height) - 140px);
    scroll-behavior: smooth;
}

/* Fullscreen messages area */
.chat-window.chat-fullscreen .chat-messages {
    height: calc(100vh - 140px) !important;
}

/* 🚀 SCROLLBAR PERSONALIZZATA */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}
/* 🚀 MESSAGGI MIGLIORATI IN FULLSCREEN */
.chat-messages .message {
    max-width: 85%;
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    animation: messageSlide 0.3s ease-out;
}

/* In fullscreen, messaggi più larghi e leggibili */
.chat-window.chat-fullscreen .chat-messages .message {
    max-width: 80%;
}

.chat-messages .user-message {
    background: linear-gradient(135deg, var(--credicheck-primary) 0%, #0f172a 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: var(--credicheck-shadow);
}

.chat-messages .bot-message {
    background: var(--credicheck-white);
    color: var(--credicheck-text);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    border: 1px solid var(--credicheck-border);
    box-shadow: var(--credicheck-shadow);
}

.chat-messages .bot-message.thinking {
    background: linear-gradient(90deg, #f8fafc 25%, #e2e8f0 50%, #f8fafc 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.suggestion-btn {
    background: var(--credicheck-white);
    color: var(--credicheck-primary);
    border: 2px solid var(--credicheck-border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--credicheck-transition);
}

.suggestion-btn:hover {
    background: var(--credicheck-primary);
    color: white;
    border-color: var(--credicheck-primary);
    transform: translateY(-1px);
    box-shadow: var(--credicheck-shadow);
}

.chat-input {
    display: flex;
    padding: 20px;
    border-top: 1px solid var(--credicheck-border);
    background: var(--credicheck-white);
    align-items: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

#upload-pdf-btn,
#clear-pdf-btn {
    background: var(--credicheck-primary);
    color: white;
    border: none;
    border-radius: var(--credicheck-radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: var(--credicheck-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

#upload-pdf-btn:hover,
#clear-pdf-btn:hover {
    background: #0f172a;
    transform: translateY(-1px);
}

#clear-pdf-btn {
    background: var(--credicheck-danger);
}

#clear-pdf-btn:hover {
    background: #dc2626;
}

#credy-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--credicheck-border);
    border-radius: var(--credicheck-radius);
    font-size: 14px;
    resize: none;
    min-height: 56px;
    max-height: 120px;
    background: var(--credicheck-white);
    color: var(--credicheck-text);
    transition: var(--credicheck-transition);
    font-family: inherit;
}

#credy-input:focus {
    outline: none;
    border-color: var(--credicheck-accent);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

#credy-send {
    background: linear-gradient(135deg, var(--credicheck-accent) 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: var(--credicheck-radius-sm);
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--credicheck-transition);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    box-shadow: var(--credicheck-shadow);
}

#credy-send:hover {
    transform: translateY(-1px);
    box-shadow: var(--credicheck-shadow-lg);
}

/* ===== LOADING E SKELETON ===== */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-skeleton {
    background: linear-gradient(90deg, #f8fafc 25%, #e2e8f0 50%, #f8fafc 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--credicheck-radius-sm);
}

.loading-text {
    height: 16px;
    margin: 8px 0;
}

.loading-title {
    height: 24px;
    width: 60%;
    margin: 16px 0;
}

/* ===== RESPONSIVE + FULLSCREEN OTTIMIZZATO ===== */
@media (max-width: 768px) {
    .risk-api-search,
    .risk-api-usage {
        padding: 16px;
        margin: 20px auto;
    }
    
    .search-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* 🚀 CHAT RESPONSIVE MIGLIORATA */
    .chat-window:not(.chat-fullscreen) {
        width: var(--chat-mobile-width);
        height: var(--chat-mobile-height);
        right: 2.5vw;
        bottom: 90px;
    }
    
    /* Fullscreen sempre ottimale su tablet */
    .chat-window.chat-fullscreen {
        width: 100vw !important;
        height: 100vh !important;
        right: 0 !important;
        bottom: 0 !important;
    }
    
    #credy-toggle {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }
    
    .usage-table {
        font-size: 12px;
    }
    
    .usage-table th,
    .usage-table td {
        padding: 12px 8px;
    }
    
    h3 {
        font-size: 24px;
    }
    
    /* Login responsive */
    .risk-api-login {
        margin: 20px auto;
        padding: 24px;
        max-width: calc(100% - 32px);
    }
    
    .login-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .login-button {
        width: 100%;
    }
    
    .register-link {
        text-align: center;
        padding: 12px;
    }
    
    /* Nuove azioni responsive */
    .actions-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    
    .action-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .action-icon {
        align-self: center;
    }
    
    .results-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    /* Messages responsive in fullscreen */
    .chat-window.chat-fullscreen .chat-messages .message {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .results .section {
        padding: 16px;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .chat-input {
        padding: 16px;
    }
    
    /* 🚀 MOBILE OTTIMIZZATO - Chat normale sempre quasi fullscreen */
    .chat-window:not(.chat-fullscreen) {
        width: calc(100vw - 16px) !important;
        height: calc(100vh - 100px) !important;
        right: 8px !important;
        bottom: 80px !important;
        border-radius: var(--credicheck-radius) !important;
    }
    
    /* Fullscreen perfetto su mobile */
    .chat-window.chat-fullscreen {
        border-radius: 0 !important;
    }
    
    .user-status {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    /* Login mobile ottimizzato */
    .risk-api-login {
        padding: 20px;
    }
    
    .login-field input[type="text"],
    .login-field input[type="password"],
    .login-field input[type="email"] {
        padding: 14px 16px;
        font-size: 16px; /* Previene zoom su iOS */
    }
    
    .login-button {
        padding: 14px 24px;
        font-size: 15px;
    }
    
    .action-card {
        padding: 16px;
        gap: 8px;
    }
    
    .action-icon {
        width: 40px;
        height: 40px;
    }
    
    /* Messages molto leggibili su mobile */
    .chat-messages .message {
        max-width: 90%;
        font-size: 15px;
        padding: 14px 18px;
    }
    
    .chat-window.chat-fullscreen .chat-messages .message {
        max-width: 95%;
    }
    
    /* Header mobile ottimizzato */
    .chat-header {
        padding: 16px 20px;
    }
    
    .chat-header h4 {
        font-size: 16px;
    }
    
    /* Input mobile friendly */
    #credy-input {
        font-size: 16px; /* Previene zoom su iOS */
        min-height: 48px;
    }
    
    #credy-send {
        padding: 14px 18px;
    }
}

/* ===== STATI SPECIALI FULLSCREEN ===== */
@media (max-width: 320px) {
    /* Extra small mobile - fullscreen sempre preferibile */
    .chat-window:not(.chat-fullscreen) {
        width: 100vw !important;
        height: calc(100vh - 80px) !important;
        right: 0 !important;
        bottom: 80px !important;
        border-radius: 8px 8px 0 0 !important;
    }
    
    .chat-messages {
        padding: 12px;
        gap: 12px;
    }
    
    .chat-input {
        padding: 12px;
        gap: 8px;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
}

/* ===== ACCESSIBILITY MIGLIORATA ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    /* Mantieni transizioni essenziali per fullscreen */
    .chat-window {
        transition: all 0.1s ease !important;
    }
}

/* Focus stati migliorati per accessibilità */
.chat-header button:focus,
#credy-fullscreen:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

#credy-toggle:focus {
    outline: 3px solid rgba(34, 197, 94, 0.5);
    outline-offset: 3px;
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .chat-window {
        border: 2px solid var(--credicheck-primary);
    }
    
    .chat-header {
        border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    }
    
    .chat-messages .message {
        border: 1px solid var(--credicheck-border);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .credy-chatbot,
    .chat-window {
        display: none !important;
    }
}

/* ===== UTILITIES FULLSCREEN ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }

/* 🚀 NUOVE UTILITY CLASSES FULLSCREEN */
.chat-fullscreen-transition {
    transition: all var(--chat-fullscreen-duration) cubic-bezier(0.4, 0, 0.2, 1);
}

.overflow-hidden {
    overflow: hidden !important;
}

.pointer-events-none {
    pointer-events: none !important;
}

/* ===== DEBUG HELPERS (solo in development) ===== */
.debug-fullscreen {
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 99999;
    display: none;
}

/* Attiva con .debug nella root */
.debug .debug-fullscreen {
    display: block;
}

/* ===== FUTURE-PROOF STYLES ===== */
/* Container queries support quando disponibile */
@supports (container-type: inline-size) {
    .chat-window {
        container-type: inline-size;
    }
    
    @container (min-width: 600px) {
        .chat-messages .message {
            max-width: 75%;
        }
    }
}

/* Smooth scrolling per browser che lo supportano */
@supports (scroll-behavior: smooth) {
    .chat-messages {
        scroll-behavior: smooth;
    }
}

/* CSS Grid areas per layout complessi futuri */
.chat-window.chat-fullscreen {
    display: grid;
    grid-template-areas: 
        "header"
        "messages"
        "input";
    grid-template-rows: auto 1fr auto;
}

.chat-window.chat-fullscreen .chat-header {
    grid-area: header;
}

.chat-window.chat-fullscreen .chat-messages {
    grid-area: messages;
}

.chat-window.chat-fullscreen .chat-input {
    grid-area: input;
}