/* ====================================
   Check-in System Styles
   Sistema de Check-in de Eventos
   ==================================== */

/* ====================================
   1. BASE & UTILITIES
   ==================================== */

.checkin-container {
    font-family: var(--font-family, 'Inter', sans-serif);
    min-height: 100vh;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ====================================
   2. QR CODE SCANNER
   ==================================== */

#qr-reader {
    border: 3px solid var(--primary-color);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-primary);
    max-width: 500px;
    margin: 0 auto;
}

#qr-reader video {
    border-radius: 8px;
    width: 100%;
    height: auto;
    display: block;
}

/* Scanner overlay com borda animada */
#qr-reader::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    border: 2px solid var(--success-color);
    border-radius: 8px;
    animation: scanner-pulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes scanner-pulse {
    0%, 100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(0.95);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Scanner Status */
.scanner-status {
    text-align: center;
    padding: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.scanner-status.scanning {
    color: var(--info-color);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.scanner-status.success {
    color: var(--success-color);
    font-weight: 600;
}

.scanner-status.error {
    color: var(--error-color);
    font-weight: 600;
}

/* Camera Controls */
.camera-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.camera-controls button {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    touch-action: manipulation;
}

#scanner-placeholder {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--bg-secondary);
    border-radius: 8px;
}

#scanner-placeholder svg {
    width: 6rem;
    height: 6rem;
    margin: 0 auto 1rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* ====================================
   3. MANUAL INPUT
   ==================================== */

.manual-input-container {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.manual-input-container input[type="text"] {
    flex: 1;
    min-height: 50px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.manual-input-container input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.manual-input-container button {
    min-height: 50px;
    min-width: 100px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

/* ====================================
   4. TICKET INFO PANEL
   ==================================== */

.ticket-panel {
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-md);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-width: 120px;
}

.info-row .value {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: right;
}

/* ====================================
   5. TICKET HOLDERS LIST
   ==================================== */

.holder-item {
    position: relative;
    padding: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    background-color: var(--bg-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    min-height: 60px;
}

.holder-item:hover {
    border-color: var(--primary-color);
    background-color: var(--hover-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.holder-item:active {
    transform: translateY(0);
}

.holder-item.selected {
    background-color: var(--hover-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.holder-item.checked-in {
    background-color: #d1fae5;
    border-color: var(--success-color);
    cursor: default;
}

[data-theme="dark"] .holder-item.checked-in {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: var(--success-color);
}

.holder-item.checked-in:hover {
    transform: none;
}

.holder-item .holder-checkbox {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 24px;
    height: 24px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.holder-item .holder-info {
    padding-right: 40px;
}

.holder-item .holder-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.holder-item .holder-details {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.holder-item .holder-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ====================================
   6. STATUS BADGES
   ==================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

.badge.checked-in,
.badge.present {
    background-color: var(--success-color);
    color: white;
}

.badge.pending,
.badge.absent {
    background-color: var(--warning-color);
    color: white;
}

.badge.error,
.badge.cancelled {
    background-color: var(--error-color);
    color: white;
}

.badge.info {
    background-color: var(--info-color);
    color: white;
}

/* Badge with icon */
.badge .icon {
    width: 0.875rem;
    height: 0.875rem;
    margin-right: 0.25rem;
}

/* ====================================
   7. STATISTICS DASHBOARD
   ==================================== */

.stat-card {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

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

.stat-card:hover::before {
    opacity: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0.5rem 0;
    line-height: 1;
}

.stat-value.success {
    color: var(--success-color);
}

.stat-value.warning {
    color: var(--warning-color);
}

.stat-value.error {
    color: var(--error-color);
}

/* Circular Progress Bar */
.circular-progress {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 1rem auto;
}

.circular-progress svg {
    transform: rotate(-90deg);
}

.circular-progress circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}

.circular-progress .progress-bg {
    stroke: var(--border-color);
}

.circular-progress .progress-bar {
    stroke: var(--primary-color);
    transition: stroke-dashoffset 0.5s ease;
}

.circular-progress .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ====================================
   8. ACTION BUTTONS
   ==================================== */

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    min-height: 50px;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    min-height: 50px;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background-color: var(--active-bg);
    border-color: var(--primary-color);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    border: none;
    min-height: 50px;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    touch-action: manipulation;
}

.btn-success:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
    border: none;
    min-height: 50px;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    touch-action: manipulation;
}

.btn-danger:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
    border: none;
    min-height: 50px;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    touch-action: manipulation;
}

.btn-warning:hover {
    filter: brightness(0.9);
}

/* Disabled state */
button:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-success:disabled,
.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ====================================
   9. MODAL (REVERT)
   ==================================== */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    max-width: 28rem;
    width: 100%;
    padding: 2rem;
    animation: slideUp 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast);
    background: none;
    border: none;
    padding: 0.25rem;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
}

.modal-footer button {
    flex: 1;
}

/* Modal specific styles */
.revert-info {
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.revert-info p {
    margin: 0.25rem 0;
}

.revert-info .holder-name {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.revert-info .holder-details {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ====================================
   10. TOAST NOTIFICATIONS
   ==================================== */

#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 90%;
    width: auto;
}

.toast {
    min-width: 300px;
    max-width: 500px;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    animation: toastSlideIn 0.3s ease;
    backdrop-filter: blur(8px);
}

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

.toast.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

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

.toast-success {
    background-color: var(--success-color);
    color: white;
}

.toast-error {
    background-color: var(--error-color);
    color: white;
}

.toast-warning {
    background-color: var(--warning-color);
    color: white;
}

.toast-info {
    background-color: var(--info-color);
    color: white;
}

.toast-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.toast-message {
    font-weight: 500;
    font-size: 0.9375rem;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.toast-close:hover {
    opacity: 1;
}

/* ====================================
   11. LOADING OVERLAY
   ==================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    background-color: var(--bg-primary);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    min-width: 200px;
}

.loading-spinner {
    width: 4rem;
    height: 4rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

/* ====================================
   12. ANIMATIONS & EFFECTS
   ==================================== */

/* Pulse animation for confirmations */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Success pulse for check-in */
.success-pulse {
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Shake animation for errors */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Fade transitions */
.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ====================================
   13. RESPONSIVE DESIGN
   ==================================== */

/* Mobile First (320px+) */
@media (max-width: 640px) {
    .stat-value {
        font-size: 2rem;
    }
    
    .manual-input-container {
        flex-direction: column;
    }
    
    .manual-input-container button {
        width: 100%;
    }
    
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .info-row .label,
    .info-row .value {
        width: 100%;
        text-align: left;
    }
    
    #toast-container {
        left: 1rem;
        right: 1rem;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
    
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .holder-item .holder-details {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    body {
        font-size: 18px;
    }
    
    .container {
        max-width: 100%;
        padding: 1.25rem;
    }
    
    #qr-reader {
        max-width: 600px;
    }
    
    button {
        min-height: 50px;
        min-width: 150px;
        font-size: 18px;
        padding: 0.9375rem 1.875rem;
        border-radius: 0.625rem;
        touch-action: manipulation;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        min-height: 50px;
        font-size: 18px;
        padding: 0 0.9375rem;
    }
    
    .holder-item {
        padding: 1.25rem;
        margin: 0.625rem 0;
        border-radius: 0.75rem;
        min-height: 70px;
    }
    
    .holder-item:active {
        background-color: var(--active-bg);
    }
    
    .stat-card {
        padding: 2rem;
    }
    
    .stat-value {
        font-size: 3rem;
    }
}

/* Landscape mode for tablets */
@media (orientation: landscape) and (max-height: 768px) {
    .scanner-container {
        float: left;
        width: 50%;
    }
    
    .ticket-info {
        float: right;
        width: 45%;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .container {
        max-width: 1280px;
        margin: 0 auto;
    }
    
    .grid-responsive {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    
    #toast-container {
        max-width: 500px;
    }
    
    .holder-item {
        transition: all 0.2s ease;
    }
    
    .holder-item:hover .holder-checkbox {
        transform: scale(1.1);
    }
}

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    .stat-value {
        font-size: 3rem;
    }
}

/* ====================================
   14. DARK MODE ADJUSTMENTS
   ==================================== */

[data-theme="dark"] .toast-success {
    background-color: var(--success-color);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .toast-error {
    background-color: var(--error-color);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .toast-warning {
    background-color: var(--warning-color);
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .toast-info {
    background-color: var(--info-color);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .modal-content {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] #qr-reader {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

/* ====================================
   15. PRINT STYLES
   ==================================== */

@media print {
    body * {
        visibility: hidden;
    }
    
    .no-print,
    .modal,
    .toast,
    .loading-overlay,
    button,
    .camera-controls {
        display: none !important;
    }
    
    .print-only {
        visibility: visible;
    }
}

/* ====================================
   16. ACCESSIBILITY
   ==================================== */

/* Focus visible for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.holder-item:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .holder-item {
        border-width: 3px;
    }
    
    .badge {
        border: 2px solid currentColor;
    }
    
    button {
        border: 2px solid currentColor;
    }
}

/* ====================================
   17. UTILITY CLASSES
   ==================================== */

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

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-4 {
    padding: 1rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}
