/* style.css - Carton Stock Scanning Workflow Modern UI */

:root {
    --bg-dark: #111b15;
    --panel-bg: #18281f;
    --panel-border: #294435;
    --accent-green: #0fae54;
    --accent-green-hover: #0d9648;
    --accent-green-glow: rgba(15, 174, 84, 0.35);
    --accent-blue: #2563eb;
    --accent-yellow: #eab308;
    --accent-red: #ef4444;
    --text-main: #f0fdf4;
    --text-muted: #94a3b8;
    --text-bright: #ffffff;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    padding: 16px;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #18281f 0%, #0d2116 100%);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-main);
    flex-wrap: wrap;
    gap: 12px;
}

.app-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-title i {
    font-size: 28px;
    color: var(--accent-green);
}

.app-title h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.5px;
}

.app-title p {
    font-size: 12px;
    color: var(--text-muted);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid var(--panel-border);
    font-size: 13px;
}

.user-badge i {
    color: var(--accent-green);
}

/* Main Grid Layout */
.workflow-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .workflow-grid {
        grid-template-columns: 1fr;
    }
}

/* Panel Styles */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-main);
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel-border);
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-bright);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title i {
    color: var(--accent-green);
}

/* Form controls & Dropdowns */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control, .form-select {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    background: #0d1711;
    border: 2px solid var(--panel-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    transition: all 0.2s ease;
    outline: none;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px var(--accent-green-glow);
}

.form-select option {
    background: #0d1711;
    color: #fff;
    padding: 8px;
}

/* Selection Badges */
.selected-state-card {
    background: rgba(15, 174, 84, 0.08);
    border: 1px solid rgba(15, 174, 84, 0.3);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selected-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.selected-info label {
    font-size: 11px;
    color: var(--accent-green);
    font-weight: 700;
    text-transform: uppercase;
}

.selected-info span {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-bright);
}

/* Scanner Viewport */
.scanner-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 14px;
    border: 2px solid var(--panel-border);
}

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

.scanner-overlay {
    position: absolute;
    top: 20%;
    left: 10%;
    width: 80%;
    height: 35%;
    border: 3px solid var(--accent-green);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.scan-laser {
    width: 100%;
    height: 2px;
    background: var(--accent-green);
    box-shadow: 0 0 12px var(--accent-green);
    position: absolute;
    top: 0;
    animation: laserScan 2s infinite ease-in-out;
}

@keyframes laserScan {
    0% { top: 0; }
    50% { top: 100%; }
    100% { top: 0; }
}

.flash-overlay {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
}

.flash-overlay.flash-success {
    background: rgba(15, 174, 84, 0.6);
    opacity: 1;
}

.flash-overlay.flash-error {
    background: rgba(239, 68, 68, 0.6);
    opacity: 1;
}

/* Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--accent-green);
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-green-hover);
    box-shadow: 0 0 15px var(--accent-green-glow);
}

.btn-secondary {
    background-color: #334155;
    color: #ffffff;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #475569;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--panel-border);
    color: var(--text-main);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

/* Single Keyboard Input Box */
.keyboard-scan-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 14px;
}

.input-with-button {
    display: flex;
    gap: 8px;
}

.input-with-button input {
    flex: 1;
}

/* Confirmation Card Display (Step 6) */
.confirmation-card {
    background: linear-gradient(145deg, #1b2e24 0%, #102117 100%);
    border: 2px solid var(--accent-green);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 0 25px rgba(15, 174, 84, 0.2);
    margin-bottom: 16px;
    display: none;
}

.confirmation-card.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

.confirm-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 174, 84, 0.2);
    color: var(--accent-green);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.confirm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.confirm-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.confirm-item.full-width {
    grid-column: span 2;
}

.confirm-item label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.confirm-item .val {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-bright);
    word-break: break-all;
}

.confirm-item .val.qty {
    font-size: 24px;
    color: var(--accent-green);
    font-weight: 800;
}

/* Status Notifications & Duplicate Warning */
.status-msg {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-msg.info {
    background: rgba(37, 99, 235, 0.15);
    border-left: 4px solid var(--accent-blue);
    color: #93c5fd;
}

.status-msg.success {
    background: rgba(15, 174, 84, 0.15);
    border-left: 4px solid var(--accent-green);
    color: #86efac;
}

.status-msg.danger {
    background: rgba(239, 68, 68, 0.15);
    border-left: 4px solid var(--accent-red);
    color: #fca5a5;
}

.status-msg.warning {
    background: rgba(234, 179, 8, 0.15);
    border-left: 4px solid var(--accent-yellow);
    color: #fde047;
}

/* Summary Table (Step 15) */
.summary-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--panel-border);
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.summary-table th {
    background: #101c15;
    color: var(--text-muted);
    font-weight: 700;
    padding: 12px 14px;
    text-transform: uppercase;
    font-size: 12px;
    border-bottom: 1px solid var(--panel-border);
}

.summary-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.summary-table tr:last-child td {
    border-bottom: none;
}

.summary-table .total-row td {
    background: #14241b;
    font-weight: 800;
    font-size: 15px;
    color: var(--accent-green);
    border-top: 2px solid var(--accent-green);
}

/* Login Page Styling */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1b2e24 0%, #0c140f 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-icon {
    font-size: 40px;
    color: var(--accent-green);
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 22px;
    color: var(--text-bright);
}

.login-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--accent-red);
    color: #fca5a5;
}

/* Modal Styling */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}

.modal-backdrop.show {
    display: flex;
}

.modal-box {
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-box.danger-modal {
    border-color: var(--accent-yellow);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.modal-header i {
    font-size: 24px;
    color: var(--accent-yellow);
}

.modal-header h3 {
    font-size: 18px;
    color: var(--text-bright);
}

.modal-body {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 20px;
}
