* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.ec-checkin-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.ec-header {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.ec-header h1 {
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.ec-header p {
    color: #666;
    font-size: 1.1em;
}

.ec-event-date {
    color: #999 !important;
    font-size: 1em !important;
    margin-top: 5px;
}

.ec-header-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.ec-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.ec-stat-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.ec-stat-card:hover {
    transform: translateY(-5px);
}

.ec-stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.ec-stat-label {
    color: #666;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ec-main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .ec-main-content {
        grid-template-columns: 1fr;
    }
}

.ec-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.ec-card h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ec-scanner-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
}

#reader {
    width: 100%;
    height: 100%;
}

.ec-scanner-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    border: 3px solid #667eea;
    border-radius: 15px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.ec-scanner-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 4px solid #667eea;
}

.ec-scanner-corner.ec-top-left {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.ec-scanner-corner.ec-top-right {
    top: -2px;
    right: -2px;
    border-left: none;
    border-bottom: none;
}

.ec-scanner-corner.ec-bottom-left {
    bottom: -2px;
    left: -2px;
    border-right: none;
    border-top: none;
}

.ec-scanner-corner.ec-bottom-right {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.ec-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.ec-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ec-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.ec-btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.ec-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(56, 239, 125, 0.4);
}

.ec-btn-warning {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    width: auto;
    padding: 10px 20px;
}

.ec-btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    width: auto;
    padding: 10px 20px;
}

.ec-btn-secondary {
    background: linear-gradient(135deg, #868f96 0%, #596164 100%);
    color: white;
    width: auto;
    padding: 10px 20px;
}

.ec-search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.ec-search-box input {
    flex: 1;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.ec-search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.ec-search-box .ec-btn {
    width: auto;
    padding: 15px 30px;
}

.ec-info-box {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.ec-info-box p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

.ec-participant-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 30px;
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.ec-participant-card h3 {
    font-size: 2em;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    padding-bottom: 15px;
}

.ec-participant-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.ec-participant-info-item {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.ec-participant-info-item label {
    display: block;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    opacity: 0.8;
}

.ec-participant-info-item .ec-value {
    font-size: 1.2em;
    font-weight: bold;
}

.ec-history-list {
    max-height: 400px;
    overflow-y: auto;
}

.ec-history-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.ec-history-item:hover {
    transform: translateX(5px);
    background: #e9ecef;
}

.ec-history-item .ec-name {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

.ec-history-item .ec-time {
    color: #666;
    font-size: 0.9em;
}

.ec-history-item .ec-ean {
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9em;
    font-family: monospace;
}

.ec-badge {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    margin-top: 10px;
}

.ec-badge-checked-in {
    background: #d4edda;
    color: #155724;
}

.ec-badge-not-checked {
    background: #fff3cd;
    color: #856404;
}

.ec-no-data {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.2em;
}

.ec-alert-container {
    margin-bottom: 20px;
}

.ec-alert {
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: bold;
    text-align: center;
    animation: ec-slideIn 0.3s ease;
}

@keyframes ec-slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ec-alert-success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.ec-alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.ec-alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffeeba;
}

.ec-full-width {
    grid-column: 1 / -1;
}

/* Fix: Assicura che participantCard sia visibile */
#participantCard {
    display: none;
}

#participantCard.show,
#participantCard[style*="display: block"] {
    display: block !important;
}

#selectionCard {
    display: none;
}

.ec-barcode-indicator {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: #667eea;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: bold;
    z-index: 1000;
    animation: ec-pulse 0.5s ease-in-out;
}

@keyframes ec-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.ec-save-indicator {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: bold;
    z-index: 1000;
    animation: ec-fadeInOut 2s ease-in-out;
}

@keyframes ec-fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
}

.ec-selection-list h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.ec-selection-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.ec-selection-item:hover {
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.ec-selection-item.ec-already-checked {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
}

.ec-participant-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.ec-participant-details {
    font-size: 0.9em;
    color: #666;
}

.ec-already-checked-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: bold;
}

.ec-login-required {
    text-align: center;
    padding: 100px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.ec-login-required h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.ec-login-button {
    display: inline-block;
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
    margin-top: 20px;
    transition: all 0.3s;
}

.ec-login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.ec-error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #f5c6cb;
}

/* Walk-in button */
.ec-btn-walkin {
    background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
    color: #333;
    width: auto;
    padding: 10px 20px;
    font-weight: 800;
}

.ec-btn-walkin:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 210, 0, 0.5);
}