﻿:root {
    /*        --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
    --primary-gradient: linear-gradient(135deg, #4361ee 0%, #4361ee 100%);
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-radius: 16px;
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
}

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf3 100%);
    background-attachment: fixed;
    position: relative;
}

    body::before {
        content: "";
        position: fixed;
        inset: 0;
        background-image: radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px);
        background-size: 24px 24px;
        pointer-events: none;
        z-index: 0;
    }

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
}

/* Header stile app */
.app-header {
    background: var(--bg-secondary);
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    position: relative;
    z-index: 10;
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
}

/* Content area scrollabile */
.app-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    padding-bottom: 100px;
    margin-bottom: 24px;
}

/* Scanner section */
.scanner-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.scanner-header {
    background: var(--primary-gradient);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.scanner-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
    animation: pulse 2s infinite;
}

    .status-dot.active {
        background: var(--success-color);
    }

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.camera-view {
    position: relative;
    background: #2d3436;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}

#camera-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-placeholder {
    text-align: center;
    padding: 40px 20px;
}

    .camera-placeholder i {
        font-size: 48px;
        opacity: 0.3;
        margin-bottom: 16px;
        color: var(--text-secondary);
    }

.scan-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border: 2px solid var(--success-color);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s;
}

    .scan-overlay.active {
        opacity: 1;
    }

    .scan-overlay::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--success-color);
        animation: scan-line 2s linear infinite;
    }

@keyframes scan-line {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(198px);
    }
}

/* Data cards */
.data-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(0,0,0,0.06);
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

    .data-row:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

.data-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

.data-value {
    font-size: 15px;
    font-weight: 500;
    text-align: right;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(0,0,0,0.05);
}

    .badge-status.success {
        background: rgba(16, 185, 129, 0.2);
        color: #10b981;
    }

    .badge-status.pending {
        background: rgba(251, 191, 36, 0.2);
        color: #fbbf24;
    }

/* Bottom action area fissa */
.bottom-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    padding: 16px 20px;
    padding-bottom: calc(16px + var(--safe-area-bottom));
    border-top: 1px solid rgba(0,0,0,0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.btn-app {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

    .btn-app:active {
        transform: scale(0.98);
    }

.btn-scanner,
.btn-confirm {
    min-height: 66px;
    padding: 12px 20px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 12px;
    margin-bottom: 12px;
    touch-action: manipulation;
}

.btn-scanner {
    background: var(--primary-gradient);
    color: white;
}

.btn-confirm {
    background: var(--success-color);
    color: white;
}

    .btn-confirm:disabled {
        background: rgba(0,0,0,0.08);
        color: var(--text-secondary);
        min-height: 66px;
        padding: 12px 20px;
        font-size: 1.05rem;
    }

/* Notifiche stile iOS */
.notification {
    position: fixed;
    top: calc(20px + var(--safe-area-top));
    left: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transform: translateY(-120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    border: 1px solid rgba(0,0,0,0.08);
}

    .notification.show {
        transform: translateY(0);
    }

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification i {
    font-size: 20px;
}

.notification.success i {
    color: var(--success-color);
}

.notification.error i {
    color: var(--danger-color);
}

/* Animazioni fluide */
* {
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.blink-smooth {
    animation: blink-smooth 1.5s ease-in-out infinite;
}

@keyframes blink-smooth {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* animazione su bottone */

.blink {
    animation-name: alternate;
    animation-duration: 500ms;
    animation-iteration-count: infinite;
    animation-timing-function: steps(2, jump-none);
}

@keyframes alternate {
    from {
        color: #fff
    }
    /*color when visible */
    to {
        color: transparent
    }
}