/* ============================================
   SmartLocker Remote - Modern UI System
   ============================================ */
:root {
    /* Color Palette - Dark Mode Default */
    --accent: #6366f1;
    /* Indigo 500 */
    --accent-hover: #4f46e5;
    /* Indigo 600 */
    --accent-light: rgba(99, 102, 241, 0.15);

    --bg-body: #0f172a;
    /* Slate 900 */
    --bg-surface: #1e293b;
    /* Slate 800 */
    --bg-surface-hover: #334155;
    /* Slate 700 */
    --bg-glass: rgba(15, 23, 42, 0.85);

    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #cbd5e1;
    /* Slate 300 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    --border: #334155;
    --border-light: #475569;

    /* Functional Colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.2);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.2);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.2);

    /* Dimensions & Spacing */
    --header-height: 64px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
    padding-bottom: 80px;
    /* Space for bottom nav or footer */
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 {
    font-size: 1.875rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main-content {
    padding-top: 1.5rem;
}

/* Header */
.app-header {
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-weight: 800;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

@media (max-width: 640px) {
    .user-name {
        display: none;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn.primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn.primary:hover {
    background: var(--accent-hover);
}

.btn.secondary {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    background: var(--border-light);
}

.btn.danger {
    background: var(--danger-bg);
    color: #fca5a5;
    border: 1px solid transparent;
}

.btn.danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

.btn.accent {
    background: var(--success);
    color: white;
}

.btn.warning {
    background: var(--warning);
    color: #1a1a1a;
}

.btn.small {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn.icon-only {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.btn.full-width {
    width: 100%;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card h3 {
    margin-bottom: 1.25rem;
}

/* Grid Systems */
.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* Lockers Grid - Highly Responsive */
.locker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding-bottom: 2rem;
}

.locker-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.locker-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.locker-card.occupied {
    border-left: 4px solid var(--success);
}

.locker-card.free {
    border-left: 4px solid var(--text-muted);
    opacity: 0.7;
}

.locker-head {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.locker-number {
    font-family: 'Monaco', monospace;
    font-weight: 700;
    font-size: 1.125rem;
}

.locker-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    text-align: center;
}

.locker-product-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.locker-product-price {
    color: var(--success);
    font-weight: 700;
}

.locker-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.875rem;
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0 0 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

.tabs-nav::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: white;
    background: var(--accent);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

/* Product List */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.product-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-surface);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.product-item:hover {
    border-color: var(--accent);
    background: #273548;
}

.product-thumb {
    width: 3rem;
    height: 3rem;
    border-radius: 8px;
    background: var(--bg-surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.product-details {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-barcode {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.product-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-box:last-child {
        grid-column: span 2;
    }
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-surface);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal-box {
    transform: translateY(0);
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
    outline: none;
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.625rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.online,
.badge.success {
    background: var(--success-bg);
    color: var(--success);
}

.badge.offline,
.badge.error {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge.primary {
    background: var(--accent);
    color: white;
}

.badge.secondary {
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--bg-surface-hover);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-danger,
.text-error {
    color: var(--danger);
}

.text-accent {
    color: var(--accent);
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-base {
    font-size: 1rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.font-bold {
    font-weight: 700;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.py-6 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-row {
    flex-direction: row;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.border-b {
    border-bottom: 1px solid var(--border);
}

.border-t {
    border-top: 1px solid var(--border);
}

.border-gray-700 {
    border-color: var(--bg-surface-hover);
}

.bg-card {
    background-color: var(--bg-surface);
}

.rounded {
    border-radius: var(--radius-sm);
}

.hidden-mobile {
    display: flex;
}

/* Bottom Sheet / Mobile Menu */
.mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-top: 1px solid var(--border);
        justify-content: space-around;
        padding: 0.75rem 0.5rem;
        z-index: 90;
        backdrop-filter: blur(10px);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        color: var(--text-muted);
        font-size: 0.7rem;
        width: 20%;
        cursor: pointer;
    }

    .mobile-nav-item.active {
        color: var(--accent);
    }

    .mobile-nav-icon {
        font-size: 1.25rem;
    }

    /* Adjust main content for bottom nav */
    .main-content {
        padding-bottom: 5rem;
    }

    /* Hide desktop tabs */
    .hidden-mobile {
        display: none;
    }
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.alert.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.alert.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}