/* ============================================================
   Soroteca Biovida - Premium Dark Mode Stylesheet
   ============================================================ */

/* ============================================================
   CSS Custom Properties (Design System)
   ============================================================ */
:root {
    /* Colors - Light Theme (Default - High Contrast) */
    --bg-primary: #e9ecef;
    --bg-secondary: #ffffff;
    --bg-tertiary: #dee2e6;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fa;
    --bg-input: #ffffff;
    --bg-input-focus: #fcfcfd;

    --border-color: #ced4da;
    --border-light: #e9ecef;
    --border-focus: #E31E24;

    --primary: #E31E24;
    --primary-hover: #ff4757;
    --primary-glow: rgba(227, 30, 36, 0.15);
    --primary-soft: rgba(227, 30, 36, 0.05);

    --success: #2ed573;
    --success-soft: rgba(46, 213, 115, 0.12);
    --warning: #ffa502;
    --warning-soft: rgba(255, 165, 2, 0.12);
    --danger: #ff4757;
    --danger-soft: rgba(255, 71, 87, 0.12);
    --info: #3498db;
    --info-soft: rgba(52, 152, 219, 0.12);

    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --text-inverse: #ffffff;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.85rem;
    --font-size-base: 0.95rem;
    --font-size-md: 1.05rem;
    --font-size-lg: 1.2rem;
    --font-size-xl: 1.6rem;
    --font-size-2xl: 2.2rem;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Borders */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px var(--primary-glow);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--border-color);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Scrollbar colors */
    --scrollbar-thumb: rgba(0, 0, 0, 0.25);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.4);
}

/* Colors - Dark Theme Override */
body.dark-theme {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a2e;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-input-focus: rgba(255, 255, 255, 0.08);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.04);

    --primary-glow: rgba(227, 30, 36, 0.3);
    --primary-soft: rgba(227, 30, 36, 0.1);

    --text-primary: #f1f1f1;
    --text-secondary: #a0a0b0;
    --text-muted: #6a6a7a;
    --text-inverse: #0a0a0f;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--border-color);

    /* Scrollbar colors override */
    --scrollbar-thumb: rgba(255, 255, 255, 0.15);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; }

button { cursor: pointer; font-family: inherit; }

input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

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

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    background: linear-gradient(180deg, #ffffff 0%, #f5f6fa 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow: hidden;
}

body.dark-theme .sidebar {
    background: linear-gradient(180deg, #0f0f18 0%, #0a0a12 100%);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-details,
.sidebar.collapsed .theme-toggle-btn,
.sidebar.collapsed .logout-btn {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-logo-img {
    width: 32px;
}

.sidebar.collapsed .user-info {
    justify-content: center;
}

.sidebar-header {
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    min-height: 72px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.sidebar-logo-img {
    width: 40px;
    height: auto;
    transition: var(--transition);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: var(--space-md) var(--space-sm);
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 0.7rem var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: 500;
    transition: var(--transition-fast);
    margin-bottom: 2px;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-label {
    transition: var(--transition);
}

.nav-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-md) var(--space-md);
}

.nav-section-title {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: var(--space-sm) var(--space-md);
    transition: var(--transition);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-base);
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--transition);
}

.user-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.logout-btn:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ============================================================
   Main Content
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--space-xl) var(--space-2xl);
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
    transition: var(--transition);
}

body.dark-theme .main-content {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, #0d0d16 100%);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f6fa 0%, #eef1f6 100%);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

body.dark-theme .login-page {
    background: linear-gradient(135deg, #0a0a0f 0%, #12121a 40%, #0f0a14 100%);
}

.login-theme-toggle {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 10;
}

.login-theme-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
}

.login-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: particleFloat 15s infinite ease-in-out;
}

.particle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; animation-duration: 12s; }
.particle:nth-child(2) { left: 30%; top: 70%; animation-delay: 2s; animation-duration: 18s; width: 6px; height: 6px; }
.particle:nth-child(3) { left: 60%; top: 30%; animation-delay: 4s; animation-duration: 14s; }
.particle:nth-child(4) { left: 80%; top: 60%; animation-delay: 1s; animation-duration: 16s; width: 3px; height: 3px; }
.particle:nth-child(5) { left: 50%; top: 80%; animation-delay: 3s; animation-duration: 20s; width: 5px; height: 5px; }
.particle:nth-child(6) { left: 15%; top: 45%; animation-delay: 5s; animation-duration: 15s; width: 4px; height: 4px; }
.particle:nth-child(7) { left: 25%; top: 15%; animation-delay: 1.5s; animation-duration: 13s; width: 3px; height: 3px; }
.particle:nth-child(8) { left: 40%; top: 60%; animation-delay: 6s; animation-duration: 22s; width: 7px; height: 7px; }
.particle:nth-child(9) { left: 70%; top: 85%; animation-delay: 3.5s; animation-duration: 19s; width: 5px; height: 5px; }
.particle:nth-child(10) { left: 90%; top: 25%; animation-delay: 2.5s; animation-duration: 17s; width: 4px; height: 4px; }
.particle:nth-child(11) { left: 5%; top: 85%; animation-delay: 7s; animation-duration: 25s; width: 8px; height: 8px; }
.particle:nth-child(12) { left: 45%; top: 10%; animation-delay: 0.5s; animation-duration: 11s; width: 3px; height: 3px; }
.particle:nth-child(13) { left: 75%; top: 15%; animation-delay: 4.5s; animation-duration: 16s; width: 5px; height: 5px; }
.particle:nth-child(14) { left: 35%; top: 35%; animation-delay: 8s; animation-duration: 21s; width: 4px; height: 4px; }
.particle:nth-child(15) { left: 85%; top: 50%; animation-delay: 9s; animation-duration: 14s; width: 6px; height: 6px; }

@keyframes particleFloat {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.2; }
    25% { transform: translate(30px, -50px) scale(1.5); opacity: 0.5; }
    50% { transform: translate(-20px, -100px) scale(1); opacity: 0.3; }
    75% { transform: translate(50px, -30px) scale(1.2); opacity: 0.4; }
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl) var(--space-2xl);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(227, 30, 36, 0.05);
    position: relative;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    border-radius: 2px;
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.login-logo-img {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 0 12px var(--primary-glow));
}

.login-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin-bottom: var(--space-lg);
}

.login-title {
    text-align: center;
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.login-subtitle {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.login-error {
    background: var(--danger-soft);
    color: var(--danger);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    text-align: center;
    border: 1px solid rgba(255, 71, 87, 0.2);
}

.login-footer {
    text-align: center;
    margin-top: var(--space-xl);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* ============================================================
   Form Elements
   ============================================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

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

.form-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.required {
    color: var(--danger);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    z-index: 1;
}

.input-wrapper .form-input {
    padding: 1.25rem 1rem 0.45rem 2.8rem;
    height: 52px;
}

.floating-label {
    position: absolute;
    left: 2.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-base);
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-fast);
}

.form-input:not(:placeholder-shown) + .floating-label,
.form-input:focus + .floating-label {
    top: 10px;
    font-size: 0.72rem;
    color: var(--primary);
    transform: none;
}

.form-input {
    width: 100%;
    padding: 0.75rem var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    transition: var(--transition-fast);
    outline: none;
}

.form-input:hover {
    border-color: rgba(0, 0, 0, 0.18);
}

body.dark-theme .form-input:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.form-input:focus {
    border-color: var(--primary);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

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

.form-input[readonly] {
    opacity: 0.7;
    cursor: not-allowed;
}

.form-input-sm {
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-sm);
}

.form-textarea {
    resize: vertical;
    min-height: 60px;
}

.form-select {
    width: 100%;
    padding: 0.75rem var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    transition: var(--transition-fast);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 2.5rem;
}

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

.form-select-sm {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: var(--font-size-sm);
}

.form-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--danger);
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}

.checkbox-label input:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 11px;
    font-weight: 700;
}

/* Radio */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.radio-label:hover {
    background: var(--bg-card);
}

.radio-label input[type="radio"] {
    accent-color: var(--primary);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.65rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    outline: none;
    text-decoration: none;
}

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #c41018);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    box-shadow: 0 4px 16px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #cc3844);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    box-shadow: 0 4px 16px rgba(255, 71, 87, 0.3);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #e09000);
    color: var(--text-inverse);
    border-color: var(--warning);
}

.btn-warning:hover {
    box-shadow: 0 4px 16px rgba(255, 165, 2, 0.3);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: var(--font-size-md);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    transform: scale(1.1);
}

.btn-icon-danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-icon-success:hover {
    background: var(--success-soft);
    color: var(--success);
}

.btn-icon-sm {
    font-size: 0.85rem;
    padding: 0.2rem;
}

.btn-text { transition: var(--transition-fast); }
.btn-loader { transition: var(--transition-fast); }

.action-buttons {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-secondary { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

/* ============================================================
   Page Layout
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ============================================================
   Dashboard
   ============================================================ */
.dashboard {}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.welcome-section {}

.welcome-text {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    margin-top: var(--space-xs);
}

.dashboard-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stats-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .stats-grid, .stats-grid-3 { grid-template-columns: 1fr; }
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-md);
}

.stat-card-red { border-left: 3px solid var(--primary); }
.stat-card-green { border-left: 3px solid var(--success); }
.stat-card-orange { border-left: 3px solid var(--warning); }
.stat-card-blue { border-left: 3px solid var(--info); }

.stat-icon {
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================================
   Refrigerators Section (Dashboard Centerpiece)
   ============================================================ */
.refrigerators-section {
    margin-top: var(--space-xl);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.section-header h2 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.fridge-legend {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-free { background: rgba(255, 255, 255, 0.1); border: 2px solid rgba(255, 255, 255, 0.15); }
.legend-occupied { background: var(--primary); box-shadow: 0 0 6px var(--primary-glow); }
.legend-inuse { background: var(--warning); box-shadow: 0 0 6px rgba(255, 165, 2, 0.3); }

/* Refrigerators Grid */
.refrigerators-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

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

/* Refrigerator Card */
.fridge-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: var(--transition);
}

.fridge-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-card);
}

.fridge-header {
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.02);
}

.fridge-title-section {}

.fridge-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.fridge-description {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Occupancy Ring */
.fridge-stats {
    flex-shrink: 0;
}

.occupancy-ring {
    width: 56px;
    height: 56px;
    position: relative;
}

.occupancy-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 3;
}

.ring-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s ease;
    filter: drop-shadow(0 0 4px var(--primary-glow));
}

.ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-primary);
}

/* Fridge Body */
.fridge-body {
    padding: var(--space-md);
    max-height: 500px;
    overflow-y: auto;
}

.no-shelves {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-lg);
}

/* Shelf Row */
.shelf-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-sm);
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition-fast);
}

.shelf-row:last-child {
    border-bottom: none;
}

.shelf-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.shelf-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 80px;
    flex-shrink: 0;
    white-space: nowrap;
}

.shelf-icon {
    font-size: 0.9rem;
}

.shelf-positions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
}

/* Position Dots */
.position-dot {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    border: 1px solid transparent;
}

.pos-number {
    font-size: 8px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.position-free {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.position-free:hover {
    background: var(--success-soft);
    border-color: var(--success);
    transform: scale(1.15);
    box-shadow: 0 0 8px var(--success-soft);
}

.position-free:hover .pos-number {
    color: var(--success);
}

.position-occupied {
    background: var(--primary-soft);
    border-color: var(--primary);
    box-shadow: 0 0 4px var(--primary-glow);
}

.position-occupied:hover {
    transform: scale(1.15);
    box-shadow: 0 0 12px var(--primary-glow);
    background: rgba(227, 30, 36, 0.25);
}

.position-occupied .pos-number {
    color: var(--primary);
}

.position-inuse {
    background: var(--warning-soft);
    border-color: var(--warning);
    box-shadow: 0 0 4px rgba(255, 165, 2, 0.2);
}

.position-inuse:hover {
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(255, 165, 2, 0.3);
}

.position-inuse .pos-number {
    color: var(--warning);
}

/* Fridge Footer */
.fridge-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-light);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
}

/* Position Tooltip */
.position-tooltip {
    position: fixed;
    z-index: 1000;
    background: var(--bg-tertiary);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    pointer-events: none;
    white-space: nowrap;
}

.tooltip-free {
    color: var(--success);
}

/* ============================================================
   Position Selector (Store Sample)
   ============================================================ */
.position-free-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.position-free-select:hover {
    background: var(--success-soft);
    border-color: var(--success);
    transform: scale(1.15);
}

.position-occupied-disabled {
    background: rgba(227, 30, 36, 0.1);
    border: 1px solid rgba(227, 30, 36, 0.2);
    cursor: not-allowed;
    opacity: 0.5;
}

.position-selected {
    background: var(--success-soft) !important;
    border-color: var(--success) !important;
    box-shadow: 0 0 12px rgba(46, 213, 115, 0.3) !important;
    transform: scale(1.2) !important;
}

.position-selected .pos-number {
    color: var(--success) !important;
    font-weight: 700;
}

.ref-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.tab-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.tab-btn:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}

.position-selector-grid {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.shelf-selector-row {
    padding: var(--space-sm);
}

.selected-position-info {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--success-soft);
    border: 1px solid rgba(46, 213, 115, 0.2);
    border-radius: var(--radius-md);
    color: var(--success);
    font-size: var(--font-size-sm);
    text-align: center;
}

/* ============================================================
   Barcode Scanner
   ============================================================ */
.barcode-scan-section {
    text-align: center;
    padding: var(--space-xl) 0;
}

.barcode-input-wrapper {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.barcode-icon {
    position: absolute;
    left: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    z-index: 1;
}

.barcode-input {
    width: 100%;
    padding: 1.2rem 1.5rem 1.2rem 3.5rem;
    background: var(--bg-input);
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    font-weight: 500;
    outline: none;
    transition: var(--transition);
    animation: barcodePulse 2s infinite ease-in-out;
}

.barcode-input:focus {
    box-shadow: 0 0 0 4px var(--primary-soft), var(--shadow-glow);
    animation: none;
    border-color: var(--primary-hover);
}

@keyframes barcodePulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
    50% { box-shadow: 0 0 0 8px transparent, 0 0 20px var(--primary-glow); }
}

.barcode-pulse {
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--primary);
    animation: barcodePulseRing 2s infinite ease-out;
    pointer-events: none;
}

@keyframes barcodePulseRing {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.05); }
}

.barcode-hint {
    margin-top: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.parsed-data-card {
    max-width: 500px;
    margin: var(--space-md) auto 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.parsed-data-card h4 {
    margin-bottom: var(--space-md);
    color: var(--success);
}

.parsed-error h4 {
    color: var(--danger) !important;
}

.parsed-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

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

.parsed-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.parsed-item label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
}

.parsed-item span {
    font-size: var(--font-size-base);
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================================
   Store Sample Stepper
   ============================================================ */
.store-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: var(--space-xl);
    padding: var(--space-md) 0;
}

.stepper-step {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    transition: var(--transition);
}

.step-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.stepper-step.active .step-number {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 12px var(--primary-glow);
}

.stepper-step.active .step-label {
    color: var(--text-primary);
}

.stepper-step.completed .step-number {
    background: var(--success);
    color: white;
}

.stepper-step.completed .step-label {
    color: var(--success);
}

.stepper-line {
    width: 40px;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .step-label { display: none; }
    .stepper-line { width: 24px; }
}

.step-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
}

.step-card h3 {
    margin-bottom: var(--space-xs);
}

.step-description {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
}

.step-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    justify-content: flex-end;
}

.manual-badge {
    display: inline-block;
    background: var(--warning-soft);
    color: var(--warning);
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

/* Confirmation Card */
.confirmation-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.confirm-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.confirm-section h4 {
    margin-bottom: var(--space-md);
    font-size: var(--font-size-base);
    color: var(--text-secondary);
}

.confirm-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm) var(--space-lg);
}

.confirm-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.confirm-item label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.confirm-item span {
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.confirm-full { grid-column: 1 / -1; }

.success-animation {
    display: flex;
    justify-content: center;
}

.success-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--success-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    animation: successBounce 0.6s ease;
}

@keyframes successBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: rgba(255, 255, 255, 0.03);
}

.data-table th {
    padding: 0.75rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 0.65rem 1rem;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.025);
}

.data-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.01);
}

.data-table tbody tr:nth-child(even):hover {
    background: rgba(0, 0, 0, 0.03);
}

body.dark-theme .data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

body.dark-theme .data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.01);
}

body.dark-theme .data-table tbody tr:nth-child(even):hover {
    background: rgba(255, 255, 255, 0.04);
}

/* ============================================================
   Filters Bar
   ============================================================ */
.filters-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    outline: none;
    transition: var(--transition-fast);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.filter-group {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    margin-top: var(--space-lg);
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 8px var(--primary-glow);
}

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

.pagination-dots {
    color: var(--text-muted);
    padding: 0 var(--space-xs);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.modal-container {
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    display: flex;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-card-sm {
    max-width: 420px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-size: var(--font-size-md);
    font-weight: 600;
}

.modal-header-danger {
    border-bottom-color: rgba(255, 71, 87, 0.2);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    line-height: 1;
}

.modal-close-btn:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.modal-body {
    padding: var(--space-xl);
    overflow-y: auto;
    flex: 1;
}

.modal-actions {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--border-light);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Sample Detail Grid */
.sample-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-item label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
}

.detail-item span {
    font-size: var(--font-size-base);
}

.detail-full { grid-column: 1 / -1; }

.detail-summary {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.detail-summary p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.detail-summary p:last-child { margin-bottom: 0; }

/* ============================================================
   Alert Boxes
   ============================================================ */
.alert {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-md);
    border: 1px solid;
}

.alert-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(255, 71, 87, 0.2);
}

.alert-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: rgba(255, 165, 2, 0.2);
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(46, 213, 115, 0.2);
}

.alert-info {
    background: var(--info-soft);
    color: var(--info);
    border-color: rgba(52, 152, 219, 0.2);
}

/* ============================================================
   Toast Notifications
   ============================================================ */
#toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    transform: translateX(120%);
    opacity: 0;
    transition: var(--transition);
    max-width: 380px;
    backdrop-filter: blur(12px);
}

.toast-enter {
    transform: translateX(0);
    opacity: 1;
}

.toast-exit {
    transform: translateX(120%);
    opacity: 0;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }

.toast-message {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 0.2rem;
    line-height: 1;
}

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

/* ============================================================
   Loading
   ============================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.loading-spinner p {
    margin-top: var(--space-md);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.spinner-ring {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.spinner-small {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-xl);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-2xl);
    color: var(--text-muted);
    grid-column: 1 / -1;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--font-size-md);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.empty-state p {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

/* ============================================================
   Admin: Fridge Management
   ============================================================ */
.fridges-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: var(--space-lg);
}

.fridge-admin-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: var(--transition);
}

.fridge-admin-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.fridge-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.fridge-admin-header h3 {
    font-size: var(--font-size-md);
    margin-bottom: var(--space-xs);
}

.fridge-admin-actions {
    display: flex;
    gap: var(--space-xs);
}

.fridge-admin-body {
    padding: var(--space-md);
}

.fridge-admin-stats {
    display: flex;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.shelves-admin-list {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.shelf-admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition-fast);
}

.shelf-admin-row:last-child { border-bottom: none; }

.shelf-admin-row:hover { background: rgba(255, 255, 255, 0.02); }

.shelf-admin-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
}

.shelf-admin-actions {
    display: flex;
    gap: var(--space-xs);
}

/* ============================================================
   Settings
   ============================================================ */
.settings-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.settings-section {
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--border-light);
}

.settings-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-section h3 {
    font-size: var(--font-size-md);
    font-weight: 600;
    margin-bottom: var(--space-lg);
}

.format-preview {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-family: 'Courier New', monospace;
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.delimiter-preview {
    color: var(--primary);
    font-weight: 700;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
}

/* ============================================================
   Audit
   ============================================================ */
.audit-page {}

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

.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }

/* ============================================================
   Animations
   ============================================================ */
.animate-fadeIn {
    animation: fadeIn 0.4s ease;
}

.animate-scaleIn {
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-scaleOut {
    animation: scaleOut 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-shake {
    animation: shake 0.4s ease;
}

.animate-slideInRight {
    animation: slideInRight 0.3s ease;
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes scaleOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
    .sidebar,
    .sidebar-toggle,
    .page-actions,
    .filters-bar,
    .pagination,
    .action-buttons,
    #toast-container,
    .modal-overlay,
    .loading-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    body {
        background: white;
        color: black;
    }

    .data-table th,
    .data-table td {
        border: 1px solid #ccc;
        color: black;
    }

    .stat-card {
        border: 1px solid #ccc;
        background: white;
    }

    .badge {
        border: 1px solid currentColor;
    }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .main-content {
        padding: var(--space-lg);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }

    .sidebar .nav-label,
    .sidebar .nav-section-title,
    .sidebar .user-details {
        display: none;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed);
        padding: var(--space-md);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-header {
        flex-direction: column;
    }

    .refrigerators-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sample-detail-grid,
    .confirm-grid {
        grid-template-columns: 1fr;
    }

    .modal-container {
        max-width: 100%;
    }

    .fridges-admin-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper {
        max-width: 100%;
    }

    .filter-group {
        flex-wrap: wrap;
    }

    .login-card {
        margin: var(--space-md);
    }

    .store-stepper {
        flex-wrap: wrap;
        gap: var(--space-xs);
    }

    .stepper-line {
        display: none;
    }
}

/* ============================================================
   Dynamic Refrigerator Shelf Layout (Dynamic Grids & Trays)
   ============================================================ */
.shelf-positions-grid .position-dot {
    width: 100%;
    height: 32px;
    border-radius: 6px;
}

.shelf-grid-dynamic {
    perspective: 800px;
    margin-top: 15px;
}

.tray-item {
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    min-height: 85px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.tray-number {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.tray-status {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.tray-patient {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-top: 4px;
}

/* States */
.tray-item.free {
    border-style: solid;
    border-color: rgba(46, 213, 115, 0.35);
    background: rgba(46, 213, 115, 0.04);
}
.tray-item.free:hover {
    border-color: var(--success);
    background: rgba(46, 213, 115, 0.12);
    box-shadow: 0 0 15px rgba(46, 213, 115, 0.25);
    transform: translateY(-2px);
}
.tray-item.free .tray-status {
    color: var(--success);
}

.tray-item.occupied {
    border-style: solid;
    border-color: rgba(227, 30, 36, 0.4);
    background: rgba(227, 30, 36, 0.05);
}
.tray-item.occupied:hover {
    border-color: var(--primary);
    background: rgba(227, 30, 36, 0.12);
    box-shadow: 0 0 15px rgba(227, 30, 36, 0.25);
    transform: translateY(-2px);
}
.tray-item.occupied .tray-status {
    color: var(--primary);
}

.tray-item.inuse {
    border-style: solid;
    border-color: rgba(255, 165, 2, 0.4);
    background: rgba(255, 165, 2, 0.05);
}
.tray-item.inuse:hover {
    border-color: var(--warning);
    background: rgba(255, 165, 2, 0.12);
    box-shadow: 0 0 15px rgba(255, 165, 2, 0.25);
    transform: translateY(-2px);
}
.tray-item.inuse .tray-status {
    color: var(--warning);
}

.tray-item.position-selected {
    border-color: var(--primary) !important;
    background: rgba(227, 30, 36, 0.15) !important;
    box-shadow: 0 0 18px rgba(227, 30, 36, 0.35) !important;
    transform: translateY(-4px) scale(1.03);
}
.tray-item.position-selected .tray-status {
    color: var(--primary) !important;
}

/* Light Theme Compatibility */
body:not(.dark-theme) .tray-item {
    background: #ffffff;
    border-color: #d1d8e0;
}
body:not(.dark-theme) .tray-item.free {
    background: rgba(46, 213, 115, 0.04);
}
body:not(.dark-theme) .tray-item.occupied {
    background: rgba(227, 30, 36, 0.03);
}
body:not(.dark-theme) .tray-item.inuse {
    background: rgba(255, 165, 2, 0.03);
}

/* Shelf selection buttons inside storage wizard */
.shelf-tab-btn {
    transition: var(--transition-fast);
}
.shelf-tab-btn.active-shelf {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
    box-shadow: 0 0 12px var(--primary-glow);
}

/* ============================================================
   TUBE RACKS (PORTA-TUBOS) & SLOTS SYSTEM
   ============================================================ */

/* Empty shelf position style */
.rack-empty-slot {
    border: 2px dashed rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.01);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
    height: 80px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease-in-out;
}
.rack-empty-slot:hover {
    border-color: var(--primary);
    background: rgba(227, 30, 36, 0.04);
    color: white;
    transform: translateY(-2px);
}
.rack-empty-slot .plus-icon {
    font-size: 1.3rem;
    margin-bottom: 0.2rem;
}
.rack-empty-slot .empty-label {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Rack container card on shelves */
.rack-container-card {
    border-radius: var(--radius-md);
    padding: 0.65rem;
    height: 80px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}
.rack-container-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}
.rack-container-card.free {
    background: linear-gradient(135deg, rgba(46, 213, 115, 0.08), rgba(46, 213, 115, 0.03));
    border: 1px solid rgba(46, 213, 115, 0.2);
}
.rack-container-card.free:hover {
    border-color: var(--success);
    box-shadow: 0 8px 15px rgba(46, 213, 115, 0.12);
}
.rack-container-card.occupied {
    background: linear-gradient(135deg, rgba(227, 30, 36, 0.1), rgba(227, 30, 36, 0.04));
    border: 1px solid rgba(227, 30, 36, 0.3);
}
.rack-container-card.occupied:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 15px rgba(227, 30, 36, 0.12);
}

.rack-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.rack-label-text {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}
.rack-occupancy-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.4);
    font-weight: 700;
    color: white;
}

/* Rack progress bar */
.rack-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: auto;
}
.rack-progress-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.4s ease-out;
}
.rack-progress-fill.green {
    background: var(--success);
}
.rack-progress-fill.yellow {
    background: var(--warning);
}
.rack-progress-fill.red {
    background: var(--primary);
}

/* Physical Board and Slot holes */
.rack-grid-board {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    margin-top: 1rem;
    border-top: 4px solid var(--primary);
}
.rack-grid-slots {
    display: grid;
    gap: 6px;
    justify-content: center;
    justify-items: center;
    align-items: center;
    margin-top: 1rem;
    max-width: 100%;
}
.rack-slot-hole {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 44px;
    min-width: 24px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255,255,255,0.05);
}
.rack-slot-hole.free {
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed rgba(46, 213, 115, 0.3);
    color: rgba(46, 213, 115, 0.7);
}
.rack-slot-hole.free:hover {
    background: rgba(46, 213, 115, 0.08);
    border-color: var(--success);
    border-style: solid;
    color: white;
    transform: scale(1.08);
}
.rack-slot-hole.occupied {
    background: linear-gradient(135deg, rgba(227, 30, 36, 0.2), rgba(227, 30, 36, 0.08));
    border: 2px solid rgba(227, 30, 36, 0.5);
    color: white;
}
.rack-slot-hole.occupied:hover {
    border-color: var(--primary);
    transform: scale(1.08);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4), 0 4px 12px rgba(227, 30, 36, 0.3);
}
.rack-slot-hole.inuse {
    background: linear-gradient(135deg, rgba(255, 165, 2, 0.2), rgba(255, 165, 2, 0.08));
    border: 2px solid rgba(255, 165, 2, 0.5);
    color: white;
}
.rack-slot-hole.inuse:hover {
    border-color: var(--warning);
    transform: scale(1.08);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4), 0 4px 12px rgba(255, 165, 2, 0.3);
}
.rack-slot-hole.selected {
    background: var(--primary) !important;
    border: 2px solid white !important;
    color: white !important;
    transform: scale(1.12) !important;
    box-shadow: 0 0 15px var(--primary-glow), inset 0 1px 2px rgba(255,255,255,0.2) !important;
}

.rack-slot-hole .slot-number {
    font-size: 0.65rem;
    opacity: 0.6;
}
.rack-slot-hole.occupied .slot-number,
.rack-slot-hole.inuse .slot-number {
    display: none;
}
.rack-slot-hole .tube-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* Tooltip updates for slots */
.rack-slot-hole[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: rgba(15, 15, 20, 0.95);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}
.rack-slot-hole[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   PORTA-TUBOS SELECTOR WIZARD & TUBE REPRESENTATIONS
   ============================================================ */

/* Refrigerator Select Tabs */
.fridge-tabs-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 2rem;
}

.fridge-tab-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.fridge-tab-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    transition: background 0.3s ease;
}

.fridge-tab-card:hover {
    border-color: rgba(227, 30, 36, 0.25);
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
}

.fridge-tab-card.active {
    background: linear-gradient(135deg, rgba(227, 30, 36, 0.08), rgba(227, 30, 36, 0.02));
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(227, 30, 36, 0.15);
}

.fridge-tab-card.active::before {
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
}

.fridge-tab-icon {
    font-size: 2.2rem;
    background: rgba(227, 30, 36, 0.05);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(227, 30, 36, 0.1);
    transition: all 0.3s ease;
}

.fridge-tab-card.active .fridge-tab-icon {
    background: rgba(227, 30, 36, 0.12);
    border-color: rgba(227, 30, 36, 0.25);
    transform: scale(1.05);
}

.fridge-tab-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.fridge-tab-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.fridge-tab-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Cabinet Drawing Visualizer */
.shelves-cabinet-visual {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05), var(--shadow-md);
    position: relative;
    backdrop-filter: blur(16px);
}

body.dark-theme .shelves-cabinet-visual {
    background: linear-gradient(145deg, rgba(20, 24, 33, 0.92), rgba(10, 12, 17, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.6), var(--shadow-lg);
}

.shelves-cabinet-visual::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px;
    width: 2px;
    background: rgba(0, 0, 0, 0.02);
    pointer-events: none;
}

body.dark-theme .shelves-cabinet-visual::before {
    background: rgba(255, 255, 255, 0.01);
}

.shelf-cabinet-level {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 3px solid rgba(0, 0, 0, 0.12);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme .shelf-cabinet-level {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: 3px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

.shelf-cabinet-level:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
    border-bottom-color: var(--primary);
    transform: translateY(-2px);
}

body.dark-theme .shelf-cabinet-level:hover {
    background: rgba(255, 255, 255, 0.025);
    border-color: rgba(255, 255, 255, 0.08);
    border-bottom-color: var(--primary);
}

.shelf-cabinet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.4rem;
}

.shelf-layout-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: normal;
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.shelf-cabinet-grid {
    display: grid;
    gap: 12px;
    width: 100%;
}

/* Shelf Grid Positions */
.shelf-grid-pos {
    min-height: 85px;
    border-radius: var(--radius-md);
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.shelf-grid-pos.empty-pos-disabled {
    border: 1px dashed var(--border-color);
    background: rgba(0, 0, 0, 0.02);
    align-items: center;
    justify-content: center;
    cursor: not-allowed;
    opacity: 0.55;
    transition: opacity 0.25s ease;
}

body.dark-theme .shelf-grid-pos.empty-pos-disabled {
    border: 1px dashed rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    opacity: 0.35;
}

.shelf-grid-pos.empty-pos-disabled:hover {
    opacity: 0.8;
}

body.dark-theme .shelf-grid-pos.empty-pos-disabled:hover {
    opacity: 0.55;
}

.shelf-grid-pos.empty-pos-addable {
    border: 1px dashed rgba(40, 167, 69, 0.3);
    background: rgba(40, 167, 69, 0.02);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme .shelf-grid-pos.empty-pos-addable {
    border: 1px dashed rgba(40, 167, 69, 0.2);
    background: rgba(40, 167, 69, 0.05);
}

.shelf-grid-pos.empty-pos-addable:hover {
    border-color: rgba(40, 167, 69, 0.8);
    background: rgba(40, 167, 69, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
}

body.dark-theme .shelf-grid-pos.empty-pos-addable:hover {
    border-color: rgba(40, 167, 69, 0.8);
    background: rgba(40, 167, 69, 0.12);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.25);
}

.empty-pos-icon {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.empty-pos-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.shelf-grid-pos.rack-pos-selectable {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.1), var(--shadow-sm);
}

body.dark-theme .shelf-grid-pos.rack-pos-selectable {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.02), var(--shadow-sm);
}

.shelf-grid-pos.rack-pos-selectable:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

body.dark-theme .shelf-grid-pos.rack-pos-selectable:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.shelf-grid-pos.rack-pos-selectable.active {
    border-color: var(--primary) !important;
    background: linear-gradient(135deg, rgba(227, 30, 36, 0.08), rgba(227, 30, 36, 0.02)) !important;
    box-shadow: 0 6px 20px rgba(227, 30, 36, 0.15) !important;
    transform: scale(1.02) translateY(-2px);
}

body.dark-theme .shelf-grid-pos.rack-pos-selectable.active {
    background: linear-gradient(135deg, rgba(227, 30, 36, 0.12), rgba(227, 30, 36, 0.02)) !important;
    box-shadow: 0 6px 20px rgba(227, 30, 36, 0.25) !important;
}

.rack-pos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 0.25rem;
}

.rack-pos-title {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.rack-pos-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 4px;
    border-radius: 3px;
}

.shelf-grid-pos.rack-pos-selectable.active .rack-pos-count {
    background: var(--primary);
    color: white;
}

.rack-pos-progress {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.4rem;
}

.rack-pos-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.rack-pos-progress-fill.green { background: var(--success); }
.rack-pos-progress-fill.yellow { background: var(--warning); }
.rack-pos-progress-fill.red { background: var(--primary); }

/* Mini Dot rack previews */
.rack-mini-dots-grid {
    display: grid;
    gap: 3px;
    justify-content: center;
    align-items: center;
    padding: 0.2rem 0;
    flex-grow: 1;
}

.mini-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.5);
    transition: transform 0.2s ease;
}

.mini-dot.dot-free {
    background: var(--success);
    opacity: 0.35;
}

.mini-dot.dot-occupied {
    background: var(--primary);
    box-shadow: 0 0 3px var(--primary-glow);
}

.shelf-grid-pos.rack-pos-selectable:hover .mini-dot {
    transform: scale(1.1);
}

/* Physical Grid Board and Interactive Slots */
.rack-grid-board-interactive {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--primary);
    margin-top: 1.5rem;
}

.rack-board-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.rack-board-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.rack-board-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.rack-physical-grid-container {
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 3D Cap Visuals */
.tube-cap-container {
    position: relative;
    width: 85%;
    height: 85%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rack-slot-hole:hover .tube-cap-container {
    transform: scale(1.18) translateY(-2px);
    z-index: 5;
}

.tube-cap {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.35), 
                inset 0 -2px 4px rgba(0, 0, 0, 0.35), 
                inset 0 2px 4px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tube-cap-gloss {
    position: absolute;
    top: 10%;
    left: 20%;
    width: 45%;
    height: 25%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
    border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%;
    transform: rotate(-12deg);
    pointer-events: none;
}

.tube-cap-label {
    font-size: min(1.8vw, 8px);
    font-weight: 800;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    line-height: 1;
}

/* Cap Color Codes (Gradients) */
.tube-cap.lavender {
    background: radial-gradient(circle at 35% 35%, #b583ff, #6214cf);
    border-color: #4b0bb3;
}
.tube-cap.red {
    background: radial-gradient(circle at 35% 35%, #ff5252, #b80000);
    border-color: #990000;
}
.tube-cap.yellow {
    background: radial-gradient(circle at 35% 35%, #ffe135, #cfa000);
    border-color: #a37c00;
}
.tube-cap.blue {
    background: radial-gradient(circle at 35% 35%, #42c7ff, #005a9e);
    border-color: #004578;
}
.tube-cap.green {
    background: radial-gradient(circle at 35% 35%, #2effda, #00a87f);
    border-color: #008766;
}
.tube-cap.grey {
    background: radial-gradient(circle at 35% 35%, #e0e0e0, #545454);
    border-color: #3d3d3d;
}
.tube-cap.black {
    background: radial-gradient(circle at 35% 35%, #555555, #111111);
    border-color: #000000;
}
.tube-cap.golden {
    background: radial-gradient(circle at 35% 35%, #ffe135, #cfa000);
    border-color: #a37c00;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6),
                0 4px 6px rgba(0, 0, 0, 0.4), 
                inset 0 -3px 6px rgba(0, 0, 0, 0.35), 
                inset 0 3px 6px rgba(255, 255, 255, 0.3);
}

/* Tube removed from slot but position active (status: in_use) */
.tube-inuse {
    opacity: 0.35;
}

.tube-inuse-icon {
    position: absolute;
    font-size: 15px;
    color: var(--warning);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    animation: rotate-inuse 2.5s linear infinite;
    z-index: 6;
}

/* Selected Bounce Transition */
.tube-selected-bounce {
    animation: tube-bounce 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite alternate;
}

@keyframes tube-bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-6px) scale(1.08); }
}

@keyframes rotate-inuse {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Cap Legend Bar */
.tube-legend-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-bottom: 1.25rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid var(--border-light);
    width: 100%;
    max-width: 780px;
}

.legend-item {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-cap {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.legend-cap.lavender { background: #9b5de5; }
.legend-cap.red { background: #ff4d4d; }
.legend-cap.yellow { background: #ffe135; }
.legend-cap.blue { background: #00bbf9; }
.legend-cap.green { background: #00f5d4; }
.legend-cap.grey { background: #cccccc; }
.legend-cap.black { background: #111111; }

