/*
ShipScan Web Scanner - Styles
Created: 2025-10-04
Status: Production - Mobile-first responsive design
*/

:root {
    --primary-color: #2563eb;
    --success-color: #16a34a;
    --error-color: #dc2626;
    --warning-color: #ea580c;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

    /* Zone colors - easy to customize */
    --zone-1-color: #aee0a6;  /* light green */
    --zone-2-color: #e0cba6;  /* light tan */
    --zone-3-color: #869ad6;  /* light blue/purple */
    --zone-4-color: #d686c7;  /* light pink/purple */
    --zone-skip-color: #d1d5db; /* light gray */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.app-header {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.login-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.login-info p {
    margin: 0.25rem 0;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Scanner Sections */
.scanner-section,
.manual-section,
.recent-scans-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.scanner-section h2,
.manual-section h2,
.recent-scans-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Camera Container */
.camera-container {
    position: relative;
}

.viewport {
    width: 100%;
    height: 300px;
    background: #000;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

#interactive.active {
    display: block;
}

#interactive canvas,
#interactive video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Scan Result */
.scan-result {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-success {
    border-left: 4px solid var(--success-color);
}

.result-error {
    border-left: 4px solid var(--error-color);
}

.result-warning {
    border-left: 4px solid var(--warning-color);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.result-icon {
    font-size: 2rem;
}

.result-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.result-details {
    display: grid;
    gap: 0.75rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--bg-color);
    border-radius: 0.25rem;
}

.detail-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar {
    height: 24px;
    background: var(--bg-color);
    border-radius: 0.25rem;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--success-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    transition: width 0.3s ease;
}

/* Recent Scans */
.recent-scans-list {
    display: grid;
    gap: 0.75rem;
}

.scan-item {
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 0.375rem;
    border-left: 3px solid var(--border-color);
}

.scan-item.matched {
    border-left-color: var(--success-color);
}

.scan-item.not_found {
    border-left-color: var(--error-color);
}

.scan-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.scan-barcode {
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.scan-time {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.scan-details {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Error Message */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error-color);
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 0.5rem;
    }

    .scanner-section,
    .manual-section,
    .recent-scans-section {
        padding: 1rem;
    }

    .app-header h1 {
        font-size: 1.25rem;
    }

    .viewport {
        height: 250px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Zone Selection Modal */
.zone-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.zone-modal.active {
    display: flex;
}

.zone-modal-content {
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.zone-modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.zone-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.zone-btn {
    padding: 1.25rem;
    font-size: 1.25rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.zone-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.zone-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.zone-btn-1 { background: var(--zone-1-color); }
.zone-btn-2 { background: var(--zone-2-color); }
.zone-btn-3 { background: var(--zone-3-color); }
.zone-btn-4 { background: var(--zone-4-color); }
.zone-btn-skip {
    background: var(--zone-skip-color);
    color: var(--text-secondary);
}

/* Zone Badge in Recent Scans */
.zone-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.zone-badge-1 { background: var(--zone-1-color); color: var(--text-primary); }
.zone-badge-2 { background: var(--zone-2-color); color: var(--text-primary); }
.zone-badge-3 { background: var(--zone-3-color); color: var(--text-primary); }
.zone-badge-4 { background: var(--zone-4-color); color: var(--text-primary); }

/* Not Found Modal Info */
.not-found-info {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--error-color);
}

.not-found-info p {
    margin: 0.5rem 0;
    color: var(--text-primary);
}

.not-found-info strong {
    color: var(--text-secondary);
}

/* Mobile responsiveness for zone modal */
@media (max-width: 640px) {
    .zone-modal-content {
        padding: 1.5rem;
    }

    .zone-modal-title {
        font-size: 1.5rem;
    }

    .zone-btn {
        padding: 1rem;
        font-size: 1.125rem;
    }
}
