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

:root {
    --primary-color: #6B7BF7;
    --primary-hover: #5A69E6;
    --background-color: #f0f2f5;
    --text-color: #1a1a1a;
    --border-color: #e5e7eb;
    --success-color: #22c55e;
    --error-color: #ff4444;
    --gray-dark: #4A4A4A;
    --gray-light: #f8fafc;
}

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

.header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.logo i {
    color: var(--primary-color);
}

.container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    padding: 2rem;
    max-width: 1440px;
    margin: 0 auto;
    height: calc(100vh - 4rem);
}

.video-section {
    position: relative;
    background: var(--gray-dark);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    height: 100%;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid var(--primary-color);
}

.top-left {
    top: 20px;
    left: 20px;
    border-right: 0;
    border-bottom: 0;
}

.top-right {
    top: 20px;
    right: 20px;
    border-left: 0;
    border-bottom: 0;
}

.bottom-left {
    bottom: 20px;
    left: 20px;
    border-right: 0;
    border-top: 0;
}

.bottom-right {
    bottom: 20px;
    right: 20px;
    border-left: 0;
    border-top: 0;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.cart-section {
    width: 400px;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    position: sticky;
    top: 2rem;
    height: fit-content;
    max-height: calc(100vh - 8rem);
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.cart-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.scan-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #64748b;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    transition: all 0.3s ease;
}

.cart-item {
    background: var(--gray-light);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.cart-item.total {
    background: #f1f5f9;
    font-weight: 600;
    border-top: 2px solid #e2e8f0;
    margin-top: 1rem;
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.checkout-button {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
}

.checkout-button:hover {
    background: var(--primary-hover);
}

.checkout-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr 350px;
        gap: 1rem;
        padding: 1rem;
    }
    
    .cart-section {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .header {
        padding: 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .video-section {
        height: 50vh;
    }

    .cart-section {
        width: 100%;
        position: relative;
        top: 0;
    }

    .cart-header {
        padding: 1rem;
    }

    .cart-items {
        padding: 0.75rem;
    }

    .cart-footer {
        padding: 1rem;
    }
}