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

:root {
    --bg-dark: #f8fafc;
    --bg-panel: #ffffff;
    --border-panel: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    
    --primary: #0284c7;
    --primary-gradient: linear-gradient(135deg, #0ea5e9, #0284c7);
    --secondary-gradient: linear-gradient(135deg, #4f46e5, #3730a3);
    
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;
    --archived: #475569;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Perfect Border Radii (Outer R = Inner R + Padding) */
    --padding-outer: 24px;
    --padding-inner: 16px;
    --radius-inner: 12px;
    --radius-outer: 28px; /* 12 + 16 = 28px */
    --radius-cabinet: 14px; /* Slightly tighter border-radius for technical metallic cabinet look */

    --gradient-color-1: rgba(14, 165, 233, 0.08);
    --gradient-color-2: rgba(99, 102, 241, 0.08);

    --text-logo-gradient: linear-gradient(135deg, #0f172a 30%, #0284c7 100%);
    --cabinet-bg: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 50%, #b8c2cc 100%);
    --cabinet-border: #94a3b8;
    --cabinet-inner-bg: rgba(255, 255, 255, 0.5);
    --modal-bg: #ffffff;
    --text-on-cabinet: #0f172a;
}

body.theme-midnight {
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.65);
    --border-panel: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #0ea5e9;
    --primary-gradient: linear-gradient(135deg, #38bdf8, #0284c7);
    --gradient-color-1: rgba(14, 165, 233, 0.15);
    --gradient-color-2: rgba(99, 102, 241, 0.15);
    --text-logo-gradient: linear-gradient(135deg, #ffffff 30%, #a5f3fc 100%);
    --cabinet-bg: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    --cabinet-border: #475569;
    --cabinet-inner-bg: rgba(15, 23, 42, 0.65);
    --modal-bg: #1e293b;
    --text-on-cabinet: #f8fafc;
}

body.theme-emerald {
    --bg-dark: #071712;
    --bg-panel: rgba(13, 38, 30, 0.6);
    --border-panel: rgba(255, 255, 255, 0.08);
    --text-primary: #ecfdf5;
    --text-secondary: #a7f3d0;
    --primary: #10b981;
    --primary-gradient: linear-gradient(135deg, #34d399, #059669);
    --gradient-color-1: rgba(16, 185, 129, 0.18);
    --gradient-color-2: rgba(52, 211, 153, 0.1);
    --text-logo-gradient: linear-gradient(135deg, #ffffff 30%, #a7f3d0 100%);
    --cabinet-bg: linear-gradient(135deg, #153e30 0%, #0d261e 100%);
    --cabinet-border: #1a5c45;
    --cabinet-inner-bg: rgba(7, 23, 18, 0.5);
    --modal-bg: #0d261e;
    --text-on-cabinet: #ecfdf5;
}

body.theme-gold {
    --bg-dark: #171109;
    --bg-panel: rgba(38, 29, 16, 0.6);
    --border-panel: rgba(255, 255, 255, 0.08);
    --text-primary: #fdfaf7;
    --text-secondary: #fde68a;
    --primary: #d97706;
    --primary-gradient: linear-gradient(135deg, #fbbf24, #b45309);
    --gradient-color-1: rgba(217, 119, 6, 0.18);
    --gradient-color-2: rgba(251, 191, 36, 0.1);
    --text-logo-gradient: linear-gradient(135deg, #ffffff 30%, #fde68a 100%);
    --cabinet-bg: linear-gradient(135deg, #3a2b16 0%, #261c0e 100%);
    --cabinet-border: #5c4320;
    --cabinet-inner-bg: rgba(23, 17, 9, 0.5);
    --modal-bg: #261d10;
    --text-on-cabinet: #fdfaf7;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, var(--gradient-color-1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, var(--gradient-color-2) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-panel);
}

.logo-section h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--text-logo-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 16px;
}

/* Quick Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-inner);
    padding: var(--padding-inner);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

.stat-icon.total { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.stat-icon.active { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.borrowed { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.archived { background: linear-gradient(135deg, #64748b, #475569); }

.stat-info .stat-val {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-info .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Control Bar (Search & Actions) */
.controls-bar {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-outer);
    padding: var(--padding-inner) var(--padding-outer);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 500px;
}

.search-wrapper input {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
    color: var(--text-primary);
    padding: 12px 16px 12px 48px;
    border-radius: var(--radius-inner);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.search-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.search-wrapper .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

/* Cupboard & Racks Layout */
.layout-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cupboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Cupboard Visualization - "Uncommon" Cabinet Look */
.cupboard-card {
    background: var(--cabinet-bg);
    border: 2px solid var(--cabinet-border);
    border-radius: var(--radius-cabinet);
    padding: var(--padding-inner);
    position: relative;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.cupboard-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(14, 165, 233, 0.2);
}

.cupboard-handle {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 60px;
    background: linear-gradient(to bottom, #94a3b8, #cbd5e1, #64748b);
    border-radius: 3px;
    border: 1px solid #475569;
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
}

.cupboard-header {
    margin-bottom: 20px;
    padding-right: 20px;
}

.cupboard-code {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    color: #ffffff;
    background: #ef4444; /* red sticker label matching physical photo */
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.15);
}

.cupboard-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-on-cabinet);
}

/* Shelves Visualization */
.shelves-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.shelf {
    background: var(--cabinet-inner-bg);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    height: 48px;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 0 12px 6px 12px;
}

/* The actual physical wood-like shelf bar */
.shelf-wood {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(to bottom, #d97706, #b45309);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.3);
}

.shelf-label {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
}

/* Visualization of files inside shelf */
.shelf-files-visual {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    width: 100%;
    height: 30px;
    overflow: hidden;
}

.file-slab {
    width: 12px;
    height: 24px;
    border-radius: 2px 2px 0 0;
    cursor: pointer;
    transition: transform var(--transition-fast), height var(--transition-fast);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.file-slab:hover {
    transform: scaleY(1.2);
    z-index: 10;
}

.file-slab.status-Active { background-color: var(--success); }
.file-slab.status-Borrowed { background-color: var(--warning); }
.file-slab.status-Archived { background-color: var(--archived); }

.shelf-empty-msg {
    font-size: 0.7rem;
    color: #334155;
    margin: 0 auto;
    font-weight: 500;
    padding-bottom: 2px;
}

/* Visual Cupboard Drawer/Expansion (Detailed Shelf View) */
.cupboard-drawer-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-outer);
    padding: var(--padding-outer);
    margin-bottom: 40px;
    display: none; /* Controlled via JS */
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 16px;
}

.drawer-info h2 {
    font-size: 1.6rem;
    font-weight: 700;
}

.drawer-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-panel);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.drawer-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.drawer-shelves-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.shelf-detail-row {
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-inner);
    border: 1px solid var(--border-panel);
    padding: var(--padding-inner);
}

.shelf-detail-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(14, 165, 233, 0.1);
    padding-bottom: 8px;
}

.files-list-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.files-list-table th, .files-list-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.files-list-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.files-list-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 6px;
}

.badge::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge.status-Active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}
.badge.status-Active::before { background: var(--success); }

.badge.status-Borrowed {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}
.badge.status-Borrowed::before { background: var(--warning); }

.badge.status-Archived {
    background: rgba(100, 116, 139, 0.15);
    color: var(--archived);
}
.badge.status-Archived::before { background: var(--archived); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-panel);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-action {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

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

.modal-content {
    background: var(--modal-bg);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-outer);
    padding: var(--padding-outer);
    max-width: 550px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

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

.form-control {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-panel);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

select.form-control option {
    background: var(--modal-bg);
    color: var(--text-primary);
}

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

/* Search results highlighters */
@keyframes highlight-glow {
    0% { border-color: var(--border-panel); box-shadow: none; }
    50% { border-color: var(--primary); box-shadow: 0 0 25px var(--primary); }
    100% { border-color: var(--border-panel); box-shadow: none; }
}

.highlighted-cupboard {
    animation: highlight-glow 2s infinite ease-in-out;
    border-width: 2px;
}

/* Logs and activity panel */
.bottom-section {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
    margin-top: 40px;
}

.activity-logs-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-outer);
    padding: var(--padding-outer);
}

.logs-list {
    max-height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.log-item {
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(255,255,255,0.02);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.log-content {
    flex: 1;
}

.log-msg {
    color: var(--text-primary);
    margin-bottom: 4px;
}

.log-file-ref {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
}

.log-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Info Panel for general record room guidelines */
.guide-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-outer);
    padding: var(--padding-outer);
}

.guide-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.guide-list li {
    display: flex;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.guide-list li strong {
    color: var(--text-primary);
}

.guide-icon {
    color: var(--primary);
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* File Details Popup Styling */
.file-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    text-align: left;
}

.detail-row {
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 10px;
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 2px;
}

.detail-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.borrower-info-box {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

/* Notifications toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    border-left: 4px solid var(--primary);
    border-radius: 6px;
    padding: 16px 20px;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-success {
    border-left-color: var(--success);
}

/* Responsiveness */
@media (max-width: 900px) {
    .bottom-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        border-radius: var(--radius-inner);
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Dashboard User Profile Header CSS */
.header-profile-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
    border-radius: 30px;
    padding: 6px 16px 6px 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.profile-avatar.badge-role-admin { background: linear-gradient(135deg, #fbbf24, #d97706); }
.profile-avatar.badge-role-establishment { background: linear-gradient(135deg, #34d399, #059669); }
.profile-avatar.badge-role-accounts { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.profile-avatar.badge-role-development { background: linear-gradient(135deg, #fdba74, #ea580c); }

.profile-details {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.profile-role {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

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

.theme-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-danger-outline {
    background: transparent !important;
    border: 1px solid var(--danger) !important;
    color: var(--danger) !important;
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
    box-shadow: none !important;
}

.btn-danger-outline:hover {
    background: var(--danger) !important;
    color: white !important;
    transform: translateY(-1px);
}

/* ==========================================================================
   Badge-Based Security Access Login Styles
   ========================================================================== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-container {
    max-width: 500px;
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-outer);
    padding: 32px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.login-header {
    border-bottom: 1px solid var(--border-panel);
    padding-bottom: 20px;
}

.terminal-status {
    background: #020617;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px 16px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
}

.terminal-status.standby {
    color: #38bdf8;
    border-color: #0284c7;
}
.terminal-status.standby .status-indicator {
    background: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
    animation: pulse-blue 1.5s infinite;
}

.terminal-status.processing {
    color: #eab308;
    border-color: #a16207;
}
.terminal-status.processing .status-indicator {
    background: #eab308;
    box-shadow: 0 0 8px #eab308;
    animation: pulse-yellow 0.8s infinite;
}

.terminal-status.success {
    color: #22c55e;
    border-color: #15803d;
}
.terminal-status.success .status-indicator {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

.terminal-status.error {
    color: #ef4444;
    border-color: #b91c1c;
}
.terminal-status.error .status-indicator {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
    animation: pulse-red 0.5s infinite;
}

/* Card Scanner Graphic */
.scanner-card-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: rgba(15, 23, 42, 0.03);
    border-radius: var(--radius-inner);
    padding: 24px;
    border: 1px dashed var(--border-panel);
    overflow: hidden;
}

.card-scanner {
    position: relative;
    width: 260px;
    height: 160px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 4px solid #475569;
    border-radius: 16px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.05), 0 8px 16px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    box-sizing: border-box;
    transition: all var(--transition-normal);
}

.card-scanner.badge-slotted {
    border-color: var(--primary);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.05), 0 0 20px var(--primary);
}

.card-scanner.access-granted {
    border-color: var(--success);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.05), 0 0 25px var(--success);
}

.scanner-bezel {
    border: 2px solid #0f172a;
    background: #020617;
    border-radius: 8px;
    height: 60px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-slot {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

.slot-opening {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 6px;
    background: #111;
    border-radius: 3px;
    box-shadow: 0 0 4px #000;
    transform: translateY(-50%);
}

.scanner-laser {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(56, 189, 248, 0.7);
    box-shadow: 0 0 10px #38bdf8, 0 0 20px #38bdf8;
    opacity: 0;
}

.scanner-laser.scanning {
    opacity: 1;
    animation: scan-sweep 1s ease-in-out;
}

.scanner-leds {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.led-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #334155;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
    transition: all var(--transition-fast);
}

.led-light.standby.active {
    background: #38bdf8;
    box-shadow: 0 0 8px #38bdf8, inset 0 1px 1px rgba(255,255,255,0.4);
}
.led-light.processing.active {
    background: #eab308;
    box-shadow: 0 0 8px #eab308, inset 0 1px 1px rgba(255,255,255,0.4);
}
.led-light.success.active {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e, inset 0 1px 1px rgba(255,255,255,0.4);
}
.led-light.error.active {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444, inset 0 1px 1px rgba(255,255,255,0.4);
}

.scanner-label {
    text-align: center;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Slotted Card Graphic (Simulating ID inserted in reader) */
.slotted-card {
    position: absolute;
    top: 50%;
    left: 20px;
    right: 20px;
    height: 70px;
    transform: translateY(-50%);
    border-radius: 6px 6px 0 0;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slot-card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slotted-card.card-ejecting {
    animation: slot-card-out 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slotted-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* PIN Keypad Section */
.pin-pad-container {
    width: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-top: 1px solid transparent;
    padding-top: 0;
}

.pin-pad-container.visible {
    max-height: 360px;
    opacity: 1;
    border-top: 1px solid var(--border-panel);
    padding-top: 16px;
}

.pin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

#pinBadgeLabel {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.pin-dots {
    display: flex;
    gap: 10px;
}

.pin-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border-panel);
    background: transparent;
    transition: all var(--transition-fast);
}

.pin-dots .dot.active {
    background: var(--text-primary);
    border-color: var(--text-primary);
    transform: scale(1.2);
}

.numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 240px;
    margin: 0 auto;
    width: 100%;
}

.num-btn {
    height: 48px;
    border-radius: 8px;
    border: 1px solid var(--border-panel);
    background: var(--bg-panel);
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.num-btn:hover {
    background: rgba(148, 163, 184, 0.15);
    border-color: var(--text-primary);
}

.num-btn:active {
    transform: scale(0.95);
}

.num-btn.danger-btn {
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 700;
    border-color: rgba(220, 38, 38, 0.2);
}
.num-btn.danger-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--danger);
}

.num-btn.primary-btn {
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
}
.num-btn.primary-btn:hover {
    box-shadow: 0 0 10px var(--primary);
}

/* Badge Drawer Cabinet Styling */
.badge-cabinet {
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-inner);
    background: var(--cabinet-bg);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-normal);
}

.cabinet-handle-bar {
    padding: 14px 20px;
    background: rgba(15, 23, 42, 0.05);
    border-bottom: 1px solid var(--border-panel);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.cabinet-handle {
    width: 60px;
    height: 6px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    position: absolute;
    left: 50%;
    top: 6px;
    transform: translateX(-50%);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.theme-midnight .cabinet-handle, 
.theme-emerald .cabinet-handle, 
.theme-gold .cabinet-handle {
    background: rgba(255, 255, 255, 0.15);
}

.cabinet-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-on-cabinet);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cabinet-status-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-on-cabinet);
    opacity: 0.7;
    letter-spacing: 0.5px;
}

.cabinet-drawer {
    height: 0;
    background: var(--cabinet-inner-bg);
    transition: height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.badge-cabinet.drawer-open .cabinet-drawer {
    height: 230px;
}

.drawer-hanging-bar {
    height: 4px;
    background: linear-gradient(to right, #94a3b8, #cbd5e1, #94a3b8);
    margin: 10px 16px 0;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.badges-rack {
    flex: 1;
    display: flex;
    gap: 16px;
    padding: 16px 20px 24px;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: flex-start;
}

/* Badge Cards Graphics */
.badge-card {
    flex: 0 0 130px;
    height: 180px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.15), inset 0 1px 1px rgba(255,255,255,0.8);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
    user-select: none;
    transform-origin: top center;
    border-top: 8px solid #cbd5e1;
}

.badge-card:hover {
    transform: translateY(8px) rotate(1deg);
    box-shadow: 0 12px 20px rgba(0,0,0,0.25);
    z-index: 10;
}

.badge-top-lanyard {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 10px;
    background: #1e293b;
    border-radius: 4px;
    border: 2px solid #64748b;
    z-index: 2;
}

.badge-card-inner {
    padding: 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    color: #1e293b;
}

.badge-chip {
    width: 22px;
    height: 18px;
    background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    border-radius: 3px;
    border: 1px solid #78350f;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.4);
    align-self: flex-start;
}

.badge-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    border: 2px solid #ffffff;
}

.badge-details {
    text-align: center;
    width: 100%;
}

.badge-name {
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.badge-role {
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.2px;
}

.badge-barcode {
    display: flex;
    justify-content: center;
    gap: 1.5px;
    width: 100%;
    height: 12px;
    background: transparent;
    opacity: 0.8;
}

.badge-barcode span {
    display: inline-block;
    height: 100%;
    background: #000;
}
.badge-barcode span:nth-child(3n) { width: 3px; }
.badge-barcode span:nth-child(3n+1) { width: 1px; }
.badge-barcode span:nth-child(3n+2) { width: 2px; }

/* Role based badge color themes */
.badge-role-admin { border-top-color: #f59e0b; }
.badge-role-admin .badge-avatar { background: linear-gradient(135deg, #fbbf24, #d97706); }
.badge-role-admin .badge-role { color: #d97706; }

.badge-role-establishment { border-top-color: #10b981; }
.badge-role-establishment .badge-avatar { background: linear-gradient(135deg, #34d399, #059669); }
.badge-role-establishment .badge-role { color: #059669; }

.badge-role-accounts { border-top-color: #3b82f6; }
.badge-role-accounts .badge-avatar { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.badge-role-accounts .badge-role { color: #2563eb; }

.badge-role-development { border-top-color: #fb923c; }
.badge-role-development .badge-avatar { background: linear-gradient(135deg, #fdba74, #ea580c); }
.badge-role-development .badge-role { color: #ea580c; }

/* Slotted Card Visual Themes */
.slotted-card.badge-role-admin { background: linear-gradient(to bottom, #d97706 0%, #0f172a 100%); }
.slotted-card.badge-role-establishment { background: linear-gradient(to bottom, #059669 0%, #0f172a 100%); }
.slotted-card.badge-role-accounts { background: linear-gradient(to bottom, #2563eb 0%, #0f172a 100%); }
.slotted-card.badge-role-development { background: linear-gradient(to bottom, #ea580c 0%, #0f172a 100%); }

/* Card Insertion Animation Styling */
.badge-card.card-inserting {
    animation: badge-card-insert-action 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Animations Keyframes */
@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.6); }
    70% { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0); }
    100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

@keyframes pulse-yellow {
    0% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.6); }
    70% { box-shadow: 0 0 0 6px rgba(234, 179, 8, 0); }
    100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0); }
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes scan-sweep {
    0% { top: 0%; opacity: 1; }
    50% { top: 100%; opacity: 1; }
    100% { top: 0%; opacity: 0; }
}

@keyframes badge-card-insert-action {
    0% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
    50% { transform: translateY(-50px) scale(0.9) rotate(-5deg); opacity: 0.5; }
    100% { transform: translateY(-150px) scale(0.6) rotate(0deg); opacity: 0; }
}

@keyframes slot-card-in {
    0% { transform: translateY(40px) scaleY(0.5); opacity: 0; }
    100% { transform: translateY(-50%) scaleY(1); opacity: 1; }
}

@keyframes slot-card-out {
    0% { transform: translateY(-50%) scaleY(1); opacity: 1; }
    100% { transform: translateY(60px) scaleY(0.2); opacity: 0; }
}

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

.shake-anim {
    animation: shake-anim 0.25s 3;
}

.setup-link:hover {
    color: var(--primary) !important;
    text-decoration: underline !important;
}

/* Admin Split Layout */
.admin-split-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    margin-top: 16px;
}

.directory-pane, .form-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.directory-pane h4, .form-pane h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-panel);
    padding-bottom: 8px;
}

.directory-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 6px;
}

.directory-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(148, 163, 184, 0.05);
    border: 1px solid var(--border-panel);
    border-radius: 10px;
    padding: 10px 14px;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.directory-item:hover {
    background: rgba(148, 163, 184, 0.1);
    transform: translateX(2px);
}

.directory-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.directory-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
}

.directory-avatar.badge-role-admin { background: linear-gradient(135deg, #fbbf24, #d97706); }
.directory-avatar.badge-role-establishment { background: linear-gradient(135deg, #34d399, #059669); }
.directory-avatar.badge-role-accounts { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.directory-avatar.badge-role-development { background: linear-gradient(135deg, #fdba74, #ea580c); }

.directory-details {
    display: flex;
    flex-direction: column;
}

.directory-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.directory-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.delete-badge-btn {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.delete-badge-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    transform: scale(1.1);
}

.delete-badge-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    color: var(--text-secondary);
}
.delete-badge-btn:disabled:hover {
    background: transparent;
    transform: none;
}

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