/* ExcelXLImpacts Simple Barcode Scan Database - Style System */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-darkest: #000000;
    --bg-darker: #050507;
    --bg-dark: #0c0c0e;
    --card-bg: rgba(8, 8, 10, 0.82);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(6, 182, 212, 0.55);
    
    --primary: #06b6d4;      /* Neon Cyan */
    --primary-glow: rgba(6, 182, 212, 0.2);
    --primary-hover: #0891b2;
    --secondary: #6366f1;    /* Indigo */
    
    --success: #10b981;      /* Emerald */
    --warning: #f59e0b;      /* Amber */
    --danger: #ef4444;       /* Rose */
    --danger-glow: rgba(239, 68, 68, 0.35);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    background-color: var(--bg-darkest);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Glassmorphism Containers */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Typography & Layout */
a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--text-primary);
}

h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -0.025em;
}

.container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
}

/* Header */
header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 240, 0.95); /* Ivory color */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

header .nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    max-width: 1280px;
    margin: 0 auto;
}

header .logo {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #0f172a 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

header .logo i {
    color: var(--primary);
    -webkit-text-fill-color: initial;
}

header .user-info {
    color: #1e293b !important;
}

header .username-display {
    color: #0f172a !important;
    font-weight: 700;
}

header .user-role-badge {
    background: rgba(6, 182, 212, 0.15) !important;
    color: #0891b2 !important;
    border: 1px solid rgba(6, 182, 212, 0.3) !important;
}

header #logout-btn {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.12);
}

header #logout-btn:hover {
    background: rgba(15, 23, 42, 0.12);
    color: #000000;
    border-color: rgba(15, 23, 42, 0.2);
}

.user-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-badge {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.role-badge.admin {
    background: rgba(6, 182, 212, 0.15);
    color: var(--primary);
    border-color: rgba(6, 182, 212, 0.3);
}

/* Forms & Buttons */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

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

.input-container {
    position: relative;
}

.input-container i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: var(--transition);
}

.form-control {
    width: 100%;
    background: rgba(7, 10, 19, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px 12px 42px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

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

.form-control:focus + i {
    color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--secondary) 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
}

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Auth Screens */
.auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Dashboard & Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
    right: -20px;
    top: -20px;
}

.stat-info h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.stat-card.today .stat-icon {
    color: var(--primary);
    background: rgba(6, 182, 212, 0.08);
    border-color: rgba(6, 182, 212, 0.15);
}

.stat-card.total .stat-icon {
    color: var(--secondary);
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.15);
}

.stat-card.duplicates .stat-icon {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
}

.stat-card.returns .stat-icon {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.15);
}

/* Scanner Area */
.scanner-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 992px) {
    .scanner-layout {
        grid-template-columns: 1fr;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.scanner-panel {
    padding: 32px;
    display: flex;
    flex-direction: column;
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.scanner-title {
    font-size: 18px;
    font-weight: 700;
}

.scanner-input-container {
    position: relative;
    margin-bottom: 24px;
}

.scanner-input-container label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.scanner-input {
    width: 100%;
    height: 50px;
    background: #070a13;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: monospace;
    letter-spacing: 0.1em;
    outline: none;
    transition: var(--transition);
}

.scanner-action-btn {
    width: 50px !important;
    height: 50px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
}

.scanner-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

.scanner-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.scanner-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-indicator.ready {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-green 1.5s infinite;
}

.status-indicator.checking {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

/* Camera Scanner panel */
.camera-panel {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.camera-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.camera-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.camera-container {
    width: 100%;
    aspect-ratio: 4/3;
    background: #020617;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.camera-placeholder {
    color: var(--text-muted);
    font-size: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding: 20px;
}

.camera-placeholder p {
    font-size: 12px;
    font-family: var(--font);
}

#reader {
    width: 100%;
    height: 100%;
}

#reader video {
    object-fit: cover !important;
}

/* Table Area */
.table-panel {
    padding: 24px;
    margin-bottom: 24px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.table-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.table-container {
    overflow-x: auto;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

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

th {
    background: rgba(12, 16, 32, 0.6);
    padding: 14px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

tr {
    transition: var(--transition);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge.success {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.danger {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge.courier {
    background: rgba(6, 182, 212, 0.1);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.25);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 17, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 24px;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 480px;
    background: #0f162a;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Duplicate Modal customization */
.modal-card.duplicate-alert {
    border: 2px solid var(--danger);
    box-shadow: 0 0 30px var(--danger-glow);
    animation: flash-red-border 2s infinite alternate;
}

.duplicate-title {
    color: var(--danger);
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.duplicate-title i {
    font-size: 48px;
    animation: pulse-scale 1s infinite alternate;
}

.duplicate-info-box {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.duplicate-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.duplicate-info-row:last-child {
    margin-bottom: 0;
}

.duplicate-info-label {
    color: var(--text-secondary);
}

.duplicate-info-val {
    color: var(--text-primary);
    font-weight: 600;
}

/* User Management Panel (Admin Tabs) */
.admin-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    gap: 16px;
}

.admin-tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 12px 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.admin-tab-btn:hover {
    color: var(--text-primary);
}

.admin-tab-btn.active {
    color: var(--primary);
}

.admin-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.user-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.user-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-item-name {
    font-weight: 600;
}

.user-item-meta {
    font-size: 12px;
    color: var(--text-muted);
}

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

/* Animations */
@keyframes pulse-green {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-scale {
    0% { transform: scale(0.9); }
    100% { transform: scale(1.1); }
}

@keyframes flash-red-border {
    0% { border-color: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }
    100% { border-color: #f87171; box-shadow: 0 0 25px rgba(239, 68, 68, 0.6); }
}

/* Utility classes */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-right {
    text-align: right;
}

.m-t-20 {
    margin-top: 20px;
}

.d-none {
    display: none !important;
}

.gap-10 {
    gap: 10px;
}

/* Full screen red blink alarm backdrop */
.modal-backdrop.flash-alert {
    background: #dc2626 !important;
    animation: blink-red-bg 0.4s infinite alternate !important;
}

@keyframes blink-red-bg {
    0% { background-color: #ef4444; }
    100% { background-color: #3b0707; }
}

/* Responsive Mobile Screen Enhancements */
@media (max-width: 768px) {
    header .nav-container {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        align-items: center;
    }
    .user-status {
        width: 100%;
        justify-content: space-between;
    }
    .table-header {
        flex-direction: column;
        align-items: stretch;
    }
    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .table-actions button, .table-actions .input-container {
        width: 100% !important;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 12px 8px;
    }
    th, td {
        padding: 10px 8px;
        font-size: 12px;
    }
    .stat-card {
        padding: 14px 18px;
    }
    .stat-value {
        font-size: 22px;
    }
    .scanner-panel {
        padding: 18px;
    }
    .scanner-input {
        font-size: 16px;
        padding: 10px 12px;
        height: 50px;
    }
    .modal-card {
        padding: 20px;
    }
}

/* Pulsing scanner red laser line animation */
@keyframes laser-pulse {
    0% {
        opacity: 0.35;
        box-shadow: 0 0 5px var(--danger);
    }
    100% {
        opacity: 1;
        box-shadow: 0 0 15px var(--danger);
    }
}

/* Dynamic Light Mode overrides for system settings */
@media (prefers-color-scheme: light) {
    :root {
        --bg-darkest: #f8fafc;
        --bg-darker: #f1f5f9;
        --bg-dark: #e2e8f0;
        --card-bg: rgba(255, 255, 255, 0.85);
        --border-color: rgba(15, 23, 42, 0.08);
        --border-focus: rgba(6, 182, 212, 0.65);
        
        --text-primary: #0f172a;
        --text-secondary: #475569;
        --text-muted: #64748b;
        
        --primary: #0891b2;      /* Cyan 600 */
        --primary-glow: rgba(8, 145, 178, 0.15);
        --primary-hover: #0369a1;
        --secondary: #4f46e5;    /* Indigo 600 */
    }
    
    body {
        background-image: 
            radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.03) 0px, transparent 50%),
            radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.03) 0px, transparent 50%);
    }
    
    .form-control, .scanner-input {
        background: #ffffff !important;
        color: #0f172a !important;
    }
    
    .btn-secondary {
        background: rgba(15, 23, 42, 0.04);
        color: #0f172a;
    }
    
    .btn-secondary:hover {
        background: rgba(15, 23, 42, 0.08);
    }
    
    th {
        background: rgba(241, 245, 249, 0.8);
    }
    
    .modal-card {
        background: #ffffff;
        box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.12);
    }
    
    .duplicate-info-box {
        background: rgba(239, 68, 68, 0.03);
    }
}
