:root {
    --color-brand-green: #AAC959;
    --color-brand-yellow: #F1E753;
    --color-grey-light: #828382;
    --color-grey-dark: #575757;
    --color-bg-white: #FFFFFF;
    --color-text-black: #1A1A1A;
    --color-border: #E0E0E0;
    --color-success: #4CAF50;
    --color-error: #F44336;

    --font-heading: 'Proxima Nova', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-body: 'Avenir Next', 'Inter', system-ui, sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: #F8F9FA;
    color: var(--color-text-black);
    line-height: 1.6;
}

h1,
h2,
h3,
.logo {
    font-family: var(--font-heading);
    font-weight: 900;
    text-transform: uppercase;
}

/* Header */
.header {
    background-color: var(--color-bg-white);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    letter-spacing: -1px;
}

.logo span {
    color: var(--color-brand-green);
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--color-grey-dark);
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-link.active,
.nav-link:hover {
    color: var(--color-brand-green);
}

/* User Profile */
.user-profile {
    position: relative;
}

.user-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    background: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    transition: background 0.2s;
    width: fit-content;
    max-width: 220px;
}

.user-trigger:hover {
    background: #f1f1f1;
}

.user-display-name {
    font-weight: 600;
    font-size: 0.9rem;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 150px;
    margin-top: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    display: none;
    overflow: hidden;
    z-index: 1000;
}

.user-dropdown.active {
    display: block;
}

.logout-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
    color: var(--color-error);
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #fff5f5;
}

/* Main Content */
.main-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Login Card */
.login-card {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    margin: 10vh auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.login-card h1 {
    margin-bottom: 0.5rem;
}

.login-card p {
    color: var(--color-grey-light);
    margin-bottom: 2rem;
}

/* Locker Grid */
.locker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.locker-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.locker-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.locker-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    background: #EEE;
}

.status-online {
    background: #E8F5E9;
    color: var(--color-success);
}

.status-offline {
    background: #FFEBEE;
    color: var(--color-error);
}

.status-error {
    background: #FFF3E0;
    color: #E65100;
    border: 1px solid #FFCC80;
}

/* Detail Screen */
.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn-back {
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--color-brand-green);
}

.stats-bar {
    display: flex;
    gap: 2rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.actions-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-item label {
    font-size: 0.8rem;
    color: var(--color-grey-light);
    margin-right: 0.5rem;
}

.stat-item span {
    font-weight: bold;
}

.tabs {
    display: flex;
    gap: 2rem;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 2rem;
}

.tab {
    padding: 1rem 0;
    cursor: pointer;
    color: #666;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.tab.active {
    color: var(--color-brand-green);
    border-bottom-color: var(--color-brand-green);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

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

.btn-primary {
    background-color: var(--color-brand-green);
    color: white;
}

.range-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #eee;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
}

.range-group input {
    width: 70px;
    padding: 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

/* Cells Grid */
.cells-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
}

.cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    transition: filter 0.2s;
}

.cell.closed {
    background-color: #fff;
    color: #1e293b;
    border: 3px solid #fca5a5;
}

.cell.open {
    background-color: #fff;
    color: #1e293b;
    border: 3px solid #86efac;
}

.cell.occupied {
    background-color: #ef4444;
    /* Red */
    color: white;
}

.cell.reserved {
    background-color: #f59e0b;
    /* Orange/Yellow */
    color: white;
}

.cell.unknown {
    background-color: #f5f5f5;
    color: #999;
    border: 2px dashed #ccc;
}

.cell:hover {
    filter: brightness(0.9);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
}

.toast {
    background: #333;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-out;
    border-left: 5px solid transparent;
}

.toast.success {
    background: #E8F5E9;
    color: #2E7D32;
    border-left-color: #4CAF50;
}

.toast.error {
    background: #FFEBEE;
    color: #C62828;
    border-left-color: #F44336;
}

.toast.info {
    background: #E3F2FD;
    color: #1565C0;
    border-left-color: #2196F3;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* User Management Extras */
.role-select {
    padding: 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
}

.role-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.role-admin {
    background: #E3F2FD;
    color: #1565C0;
}

.role-manager {
    background: #F3E5F5;
    color: #7B1FA2;
}

.role-client {
    background: #F1F8E9;
    color: #33691E;
}


.user-trigger:hover {
    background: #f5f5f5;
}

.user-display-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
}

/* Progress Bar */
.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--color-brand-green);
    transition: width 0.3s;
}

/* Disk Refinements */
.file-preview-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
}

.copy-btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100px;
}

.pencil-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    font-size: 0.8rem;
}

.pencil-icon:hover {
    opacity: 1;
}

.link-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.link-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
    color: #666;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--color-brand-green);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* Disk File Cards */
.file-preview-card {
    background: white;
    padding: 5px;
    border-radius: 8px;
    border: 1px solid #eee;
    font-size: 0.7rem;
    width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 3px;
}

.copy-btn {
    background: #f1f1f1;
    border: 1px solid #ddd;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #e0e0e0;
}

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

.role-unknown {
    background: #F5F5F5;
    color: #616161;
}

/* Link Row Redesign */
.link-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.4rem;
    position: relative;
    transition: background 0.2s;
    width: 380px;
}

.link-box:hover {
    background: #f1f3f5;
}

.link-box .link-path {
    flex: 1;
    font-family: monospace;
    font-size: 0.72rem;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 60px;
    /* Space for icons */
    min-width: 0;
}

.link-box .link-path strong {
    color: var(--color-brand-green);
    background: #eef5e6;
    padding: 0 4px;
    border-radius: 2px;
    transition: background 0.2s, color 0.2s;
}

.link-box .link-path:hover strong {
    background: var(--color-brand-green);
    color: white;
}

.link-box:hover .actions {
    opacity: 1;
}

.link-box .actions {
    display: flex;
    gap: 6px;
    opacity: 0.4;
    transition: opacity 0.2s;
    background: inherit;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.link-box .action-icon {
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    transition: background 0.1s;
}

.link-box .action-icon:hover {
    background: #dee2e6;
    color: var(--color-brand-green);
}

.file-name-text {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 2px 6px;
    margin: -2px -6px;
    border-radius: 4px;
}

.file-name-text:hover {
    background: #f1f3f5;
    color: var(--color-brand-green);
}

.file-preview-img,
.file-icon-preview {
    cursor: pointer;
    transition: transform 0.2s;
}

.file-preview-img:hover,
.file-icon-preview:hover {
    transform: scale(1.05);
}

.file-name-cell {
    min-width: 140px;
    max-width: 300px;
}

.file-name-text {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meta-info {
    font-size: 0.7rem;
    color: #999;
    margin-top: 0.2rem;
}

.gender-badge {
    font-size: 1.2rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.gender-badge.male {
    background: #E3F2FD;
}

.gender-badge.female {
    background: #FCE4EC;
}

.gender-badge.unknown {
    background: #F5F5F5;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: modalSlide 0.3s;
}

@keyframes modalSlide {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* History Lists in Modal */
.history-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.history-section h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--color-grey-dark);
}

.history-list {
    list-style: none;
    padding: 0;
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.history-list li {
    padding: 0.4rem 0;
    border-bottom: 1px dashed #eee;
    display: flex;
    justify-content: space-between;
}

.history-time {
    color: #999;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

/* Cell Popup Specifics */
.popup-status-large {
    font-size: 3rem;
    text-align: center;
    margin: 1rem 0;
}

.popup-status-text {
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

/* Compact Table Styles */
.compact-table th,
.compact-table td {
    padding: 0.5rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.compact-table tr {
    height: auto;
}

.compact-table .btn-sm {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

/* Modern Form Controls & User Roles UI */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
    font-size: 0.85rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #f8f9fa;
    color: #212529;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-brand-green);
    box-shadow: 0 0 0 3px rgba(170, 201, 89, 0.2);
    background-color: #fff;
}

.form-control:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    color: #6c757d;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

.custom-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    background: #f8f9fa;
    padding: 6px 12px 6px 8px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.custom-checkbox-label:hover {
    background: #eef5e6;
    border-color: #d1e5b3;
}

.custom-checkbox-label:has(input:checked) {
    background: #fff;
    border-color: var(--color-brand-green);
    box-shadow: 0 2px 8px rgba(170, 201, 89, 0.15);
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--color-brand-green);
    flex-shrink: 0;
    display: block;
}