:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --sidebar-bg: rgba(15, 23, 42, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --error: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Background Orbs */
.background-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.6;
    animation: float 20s infinite alternate ease-in-out;
}

.orb-1 { width: 400px; height: 400px; background: #4338ca; top: -100px; left: -100px; }
.orb-2 { width: 500px; height: 500px; background: #0f766e; bottom: -150px; right: -100px; animation-delay: -5s; }
.orb-3 { width: 300px; height: 300px; background: #9333ea; top: 50%; left: 50%; transform: translate(-50%, -50%); animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    z-index: 10;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.2rem;
    border: none;
    padding: 0;
}

.profile-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-item {
    padding: 1rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.profile-item:hover {
    background: rgba(255,255,255,0.05);
}

.profile-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.4);
}

.profile-item .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.profile-item.active .status-dot {
    background: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color);
}

.main-content {
    flex: 1;
    padding: 2rem 4rem;
    overflow-y: auto;
}

header {
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

header h1 span {
    color: var(--accent-color);
    background: linear-gradient(to right, #3b82f6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

header #active-device-id {
    color: var(--text-primary);
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-color); }
    .main-content { padding: 2rem; }
    main { grid-template-columns: 1fr; }
}

/* Glassmorphism Cards */
.glassmorphism {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

h2 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Drop Zone */
.drop-zone {
    width: 100%;
    height: 180px;
    padding: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: inherit;
    font-weight: 500;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s ease;
}

.drop-zone:hover, .drop-zone--over {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
    color: var(--text-primary);
}

.drop-zone__input {
    display: none;
}

.hidden {
    display: none !important;
}

#image-preview-container {
    width: 100%;
    height: 180px;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.5);
    position: relative;
}

#image-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.clear-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    margin: 0 !important;
    padding: 0.4rem 0.8rem !important;
    background: rgba(0,0,0,0.7) !important;
}

/* Sensor Inputs */
.sensor-inputs {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.2);
    color: white;
    font-family: inherit;
    transition: border-color 0.3s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.input-group select option {
    background: var(--bg-color);
    color: var(--text-primary);
}

#batch-preview-list {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-width: calc(100% - 1.5rem);
}

.preview-chip {
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.75rem;
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
    opacity: 0.7;
}

/* Buttons */
.btn {
    display: block;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn.sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    width: auto;
}

.btn.primary {
    background-color: var(--accent-color);
    color: white;
    margin-top: 1.5rem;
}

.btn.primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn.secondary {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

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

.btn:disabled {
    background-color: #475569;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none !important;
}

/* Timeline */
.timeline {
    list-style: none;
    padding-left: 1.5rem;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 23px;
    width: 2px;
    background: var(--border-color);
}

.step {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 2.5rem;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.step:last-child {
    margin-bottom: 0;
}

.step.active {
    opacity: 1;
}

.step.completed {
    opacity: 1;
}

.step .icon {
    position: absolute;
    left: -7px;
    top: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 3px solid #64748b;
    z-index: 1;
    transition: all 0.3s ease;
}

.step.active .icon {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
    animation: pulse 1.5s infinite;
}

.step.completed .icon {
    border-color: var(--success);
    background: var(--success);
}

.step.error .icon {
    border-color: var(--error);
    background: var(--error);
}

.step h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.step .detail {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.2);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}
