:root {
    --color-primary: #2fac4a;
    --color-primary-dark: #228c38;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --text-main: #0f172a;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
}

* { box-sizing: border-box; font-family: 'Outfit', sans-serif; }
body { margin: 0; background-color: var(--color-bg); color: var(--text-main); }

/* --- PUBLIC AREA --- */
.public-container { max-width: 600px; margin: 50px auto; padding: 30px; background: white; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
.logo-box { text-align: center; margin-bottom: 30px; }
.logo-box h1 { margin: 10px 0; font-size: 2rem; color: var(--text-main); }
.logo-box p { color: var(--text-light); line-height: 1.5; }

.search-form { display: flex; gap: 10px; margin-bottom: 20px; }
.search-form input { flex: 1; padding: 15px; border: 2px solid var(--border-color); border-radius: 8px; font-size: 1.1rem; outline: none; transition: 0.2s; }
.search-form input:focus { border-color: var(--color-primary); }
.btn { padding: 12px 24px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; border: none; transition: 0.2s; }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }

.hidden { display: none !important; }

.result-box { margin-top: 20px; }
.info-msg, .error-msg, .success-msg { padding: 15px; border-radius: 8px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.error-msg { background: #fef2f2; color: #b91c1c; }
.info-msg { background: #eff6ff; color: #1d4ed8; }
.success-msg { background: #f0fdf4; color: #15803d; }

.device-card { border: 1px solid var(--border-color); padding: 20px; border-radius: 12px; }
.device-card h3 { margin: 0 0 10px 0; font-size: 1.5rem; }
.device-card .color-info { margin: 0; color: var(--text-light); }
.device-card hr { border: none; border-top: 1px solid var(--border-color); margin: 15px 0; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 50px; font-weight: 700; font-size: 0.9rem; margin-top: 10px; }
.status-badge.success { background: #dcfce7; color: #166534; }
.status-badge.danger { background: #fee2e2; color: #991b1b; }

/* --- ADMIN DASHBOARD --- */
.admin-layout { max-width: 1200px; margin: 0 auto; padding: 20px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; background: white; padding: 20px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 20px; }
.admin-panels { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
@media(max-width: 900px) { .admin-panels { grid-template-columns: 1fr; } }

.card { background: white; padding: 20px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.card h2 { margin-top: 0; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 20px; color: var(--color-primary); }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 0.9rem; }
.form-group input, .form-group select { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px; border-bottom: 1px solid var(--border-color); text-align: left; }
table th { background: var(--color-bg); font-weight: 600; color: var(--text-light); }
.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.badge.magazzino { background: #fef3c7; color: #92400e; }
.badge.venduto { background: #dcfce7; color: #166534; }

/* --- LOGIN MODAL --- */
.login-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.95); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-card { background: white; padding: 40px; border-radius: 16px; width: 350px; text-align: center; }

/* --- PRINT CONTRACT LAYOUT --- */
.print-only { display: none; }

@media print {
    body * { visibility: hidden; }
    .print-only, .print-only * { visibility: visible; }
    .print-only { position: absolute; left: 0; top: 0; width: 100%; display: block; background: white; padding: 40px; font-family: 'Times New Roman', Times, serif; font-size: 14pt; }
    
    .print-header { text-align: center; margin-bottom: 40px; border-bottom: 2px solid #000; padding-bottom: 20px; }
    .print-header h1 { margin: 0; font-size: 24pt; text-transform: uppercase; }
    .print-header p { margin: 5px 0 0 0; }
    
    .print-section { margin-bottom: 30px; }
    .print-section h3 { background: #f0f0f0; padding: 5px 10px; border: 1px solid #ccc; font-size: 16pt; margin-top: 0; }
    .print-row { display: flex; margin-bottom: 15px; border-bottom: 1px dotted #ccc; padding-bottom: 5px; }
    .print-label { font-weight: bold; width: 30%; }
    .print-value { width: 70%; }
    
    .print-signatures { margin-top: 60px; display: flex; justify-content: space-between; }
    .sig-box { width: 40%; text-align: center; border-top: 1px solid #000; padding-top: 10px; }

    .print-warranty-box { border: 2px solid #000; padding: 15px; margin-top: 20px; text-align: center; font-weight: bold; }
}
