/* Custom Premium Design System - Dark Glassmorphism */

:root {
    --bg-dark: #07050d;
    --panel-bg: rgba(15, 11, 26, 0.55);
    --panel-border: rgba(255, 255, 255, 0.07);
    --panel-glow: rgba(138, 43, 226, 0.15);
    
    --text-primary: #f5f5f9;
    --text-secondary: #9ea2b5;
    --text-muted: #64687a;
    
    --primary-purple: #8a2be2;
    --primary-blue: #00b4d8;
    --primary-green: #00f5d4;
    --primary-red: #ff5a5f;
    
    --gradient-purple: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    --gradient-blue: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    --gradient-green: linear-gradient(135deg, #00f5d4 0%, #01b49e 100%);
    --gradient-panel: linear-gradient(135deg, rgba(25, 18, 41, 0.7) 0%, rgba(12, 8, 20, 0.7) 100%);
    
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    
    --font-heading: 'Outfit', 'Inter', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 20px rgba(138, 43, 226, 0.25);
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 40px;
}

/* Background Glowing Elements */
.background-decor {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
}

.sphere-1 {
    width: 500px;
    height: 500px;
    background: var(--primary-purple);
    top: -10%;
    right: -10%;
}

.sphere-2 {
    width: 600px;
    height: 600px;
    background: var(--primary-blue);
    bottom: -10%;
    left: -10%;
}

/* Base Layout Container */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px;
}

/* Glassmorphism Panel style */
.glass-panel {
    background: var(--gradient-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-main);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-main), 0 0 30px rgba(138, 43, 226, 0.05);
}

/* Header design */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    margin-bottom: 25px;
    background: rgba(18, 13, 30, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-md);
}

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

.logo i {
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(138, 43, 226, 0.6));
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.neon-text-purple {
    color: #b373fa;
    text-shadow: 0 0 10px rgba(179, 115, 250, 0.4);
}

.neon-text-blue {
    color: var(--primary-blue);
    text-shadow: 0 0 10px rgba(0, 180, 216, 0.4);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-red); /* default red */
    box-shadow: 0 0 8px var(--primary-red);
}

.status-dot.connected {
    background-color: #00ff88;
    box-shadow: 0 0 8px #00ff88;
}

.status-dot.warning {
    background-color: #ffaa00;
    box-shadow: 0 0 8px #ffaa00;
}

.status-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Config Panel styling */
.config-panel {
    margin-bottom: 25px;
    border-left: 3px solid var(--primary-purple);
}

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

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.panel-body {
    padding: 24px;
}

.panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

/* Forms layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 580px) {
    .form-group-row {
        grid-template-columns: 1fr;
    }
}

label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
}

label .required {
    color: var(--primary-red);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.input-with-icon input,
.input-with-icon select {
    width: 100%;
    padding: 12px 16px 12px 42px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-body);
    transition: var(--transition-smooth);
}

.input-with-icon input:focus,
.input-with-icon select:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.25);
    background: rgba(0, 0, 0, 0.4);
}

.disabled-input input {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: transparent;
}

.btn-toggle-visibility {
    position: absolute;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.btn-toggle-visibility:hover {
    color: var(--text-primary);
}

.help-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Button style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-purple);
    color: #ffffff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(138, 43, 226, 0.45);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
}

.btn-icon-only {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
}

.btn-full {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-danger-icon:hover {
    background: rgba(255, 90, 95, 0.15);
    color: var(--primary-red);
}

/* Main Workspace Grid */
.workspace-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 25px;
    margin-bottom: 25px;
}

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

/* Left workspace - Capture tools */
.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--panel-border);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Camera tab styling */
.camera-viewport-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #000000;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--panel-border);
}

#camera-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scan-guide {
    width: 85%;
    height: 70%;
    border: 2px dashed rgba(0, 180, 216, 0.6);
    border-radius: var(--border-radius-md);
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.4);
    position: relative;
}

.scan-guide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 20px rgba(0, 180, 216, 0.2);
}

/* Pulse Scan Loader */
.scanning-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 5, 13, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.scan-bar {
    width: 85%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary-blue), transparent);
    position: absolute;
    animation: scanning 2s linear infinite;
    box-shadow: 0 0 15px var(--primary-blue);
}

.scan-text {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 500;
    margin-top: 20px;
    color: var(--primary-blue);
    animation: textPulse 1.5s ease-in-out infinite alternate;
}

@keyframes scanning {
    0% { top: 15%; }
    50% { top: 85%; }
    100% { top: 15%; }
}

@keyframes textPulse {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

.camera-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    gap: 15px;
}

.select-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition-smooth);
}

.select-input:focus {
    border-color: var(--primary-purple);
}

/* Upload tab styling */
.dropzone {
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius-lg);
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 30px;
    text-align: center;
}

.dropzone:hover {
    border-color: var(--primary-purple);
    background: rgba(138, 43, 226, 0.05);
}

.dropzone.dragover {
    border-color: var(--primary-blue);
    background: rgba(0, 180, 216, 0.08);
}

.dropzone-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 15px;
    transition: var(--transition-smooth);
}

.dropzone:hover .dropzone-icon {
    color: var(--primary-purple);
    transform: translateY(-5px);
}

.dropzone h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
}

.dropzone p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.file-limits {
    font-size: 11px;
    color: var(--text-muted);
}

/* Image preview styling */
.preview-area {
    margin-top: 20px;
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-md);
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

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

.preview-header h4 {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.img-preview-wrapper {
    width: 100%;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.img-preview-wrapper img {
    max-width: 100%;
    max-height: 250px;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

/* Form Styling right side */
.form-grid-vertical {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom Scrollbar for overflow forms & logs */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.form-divider {
    border: none;
    border-top: 1px solid var(--panel-border);
    margin: 10px 0;
}

.select-input-styled {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%239ea2b5' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.form-submit-wrapper {
    margin-top: 25px;
}

/* Recent Logs Dashboard bottom */
.logs-panel {
    width: 100%;
}

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

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.search-box input {
    padding: 8px 12px 8px 34px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 13px;
    width: 250px;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    outline: none;
    width: 320px;
    border-color: var(--primary-blue);
    background: rgba(0, 0, 0, 0.4);
}

.table-responsive {
    overflow-x: auto;
    max-height: 400px;
}

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

.scan-table th,
.scan-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.scan-table th {
    background: rgba(0, 0, 0, 0.2);
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.scan-table tbody tr {
    transition: var(--transition-smooth);
}

.scan-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.card-img-cell {
    width: 60px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--panel-border);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.card-img-cell:hover {
    transform: scale(1.5);
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

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

.text-muted {
    color: var(--text-muted);
}

.row-id {
    font-weight: 600;
    color: var(--primary-blue);
}

.row-company {
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-product {
    background: rgba(0, 180, 216, 0.15);
    color: #4cc9f0;
    border: 1px solid rgba(0, 180, 216, 0.25);
}

/* Toast System notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    background: rgba(15, 11, 26, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--primary-green);
    box-shadow: 0 10px 30px rgba(0, 245, 212, 0.2);
    border-radius: var(--border-radius-md);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    border-color: var(--primary-red);
    box-shadow: 0 10px 30px rgba(255, 90, 95, 0.2);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
}

.toast-icon {
    font-size: 18px;
}

.toast.error .toast-icon {
    color: var(--primary-red);
}

.toast:not(.error) .toast-icon {
    color: var(--primary-green);
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
}

/* Utilities */
.hidden {
    display: none !important;
}
