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

:root {
    --primary: #5B8DEF;
    --success: #4CAF50;
    --danger: #FF5252;
    --bg: #F5F7FA;
    --card: #FFFFFF;
    --text: #333333;
    --text-light: #888888;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 20px 0;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Scanner Box */
.scanner-box {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 280px;
    margin-bottom: 20px;
}

#reader {
    width: 100%;
}

#reader video {
    border-radius: var(--radius);
}

.scan-indicator {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.scanning .scan-indicator {
    opacity: 1;
    animation: scan 1.5s ease-in-out infinite;
}

@keyframes scan {
    0%, 100% { transform: translateY(-60px); }
    50% { transform: translateY(60px); }
}

/* Scan Button */
.scan-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    margin-bottom: 25px;
}

.scan-btn:hover {
    transform: scale(1.02);
}

.scan-btn:active {
    transform: scale(0.98);
}

.scan-btn.active {
    background: var(--danger);
}

.scan-btn.active .btn-icon {
    display: inline-block;
}

.scan-btn.active .btn-icon::before {
    content: "■";
}

.btn-icon {
    font-size: 0.9rem;
}

/* Results */
.results {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.results-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: 600;
}

.clear-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.85rem;
}

.results-list {
    max-height: 300px;
    overflow-y: auto;
}

.empty {
    text-align: center;
    color: var(--text-light);
    padding: 30px;
}

/* Result Item */
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease;
}

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

.result-info {
    flex: 1;
    min-width: 0;
}

.result-code {
    font-weight: 600;
    font-size: 0.95rem;
    word-break: break-all;
}

.result-meta {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

.result-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: var(--card);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary);
    color: white;
}

/* Toast */
.toast {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.9rem;
    transition: bottom 0.3s ease;
    z-index: 100;
}

.toast.show {
    bottom: 30px;
}

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

/* Scrollbar */
.results-list::-webkit-scrollbar {
    width: 4px;
}

.results-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* Mobile */
@media (max-width: 480px) {
    .app {
        padding: 15px;
    }
    
    .scanner-box {
        min-height: 250px;
    }
}
.result-link {
    color: var(--primary);
    text-decoration: none;
    display: block;
    transition: color 0.2s;
}

.result-link:hover {
    color: #3D6FD1;
    text-decoration: underline;
}

.result-item.is-link {
    border-left: 3px solid var(--primary);
}

.open-btn {
    background: var(--primary) !important;
    color: white !important;
}

.open-btn:hover {
    background: #3D6FD1 !important;
}

/* Animation pour les liens */
.result-item.is-link .result-link::before {
    content: '';
    display: inline-block;
    margin-right: 4px;
}

.result-item.is-link:hover {
    background: #EEF4FF;
}
