/* INVOLAB - Neumorphic Design System */

:root {
    --bg-primary: #E8EDF2;
    --bg-secondary: #DDE3EA;
    --shadow-dark: #A8B5C5;
    --shadow-light: #FFFFFF;
    --text-primary: #1A2530;
    --text-secondary: #3D4F60;
    --text-muted: #6B7A8A;
    --brand-blue: #004B93;
    --brand-blue-hover: #003A73;
    --brand-red: #E32934;
    --status-green-bg: #D9EAD3;
    --status-green-fg: #274E13;
    --status-yellow-bg: #FFF2CC;
    --status-yellow-fg: #7F6000;
    --status-red-bg: #F4CCCC;
    --status-red-fg: #990000;
    --border-light: rgba(168, 181, 197, 0.4);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

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

/* SVG Icon styles */
.icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-lg {
    width: 24px;
    height: 24px;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background: var(--bg-primary);
    padding: 24px 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-right: 1px solid var(--border-light);
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--shadow-dark); border-radius: 3px; }

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    margin-bottom: 28px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--brand-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-text {
    font-family: 'Sora', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--brand-blue);
    letter-spacing: -0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: 'Work Sans', sans-serif;
}

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

.nav-item.active {
    background: var(--bg-secondary);
    box-shadow: 
        inset 2px 2px 5px var(--shadow-dark),
        inset -2px -2px 5px var(--shadow-light);
    color: var(--brand-blue);
    font-weight: 600;
}

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

.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 8px 16px;
    margin-top: 8px;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    min-height: 100vh;
    padding: 24px 32px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: nowrap;
    gap: 16px;
}
.top-bar .page-title {
    flex: 1 1 auto;
    min-width: 0;
}
.top-bar .top-bar-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title {
    font-family: 'Sora', sans-serif;
    font-size: clamp(15px, 2.2vw, 28px);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    box-shadow: 
        inset 2px 2px 5px var(--shadow-dark),
        inset -2px -2px 5px var(--shadow-light);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

/* Messages */
.messages-container {
    margin-bottom: 20px;
}

.message {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 14px;
}

.message-success {
    background: var(--status-green-bg);
    color: var(--status-green-fg);
    border: 1px solid var(--status-green-fg);
}

.message-error {
    background: var(--status-red-bg);
    color: var(--status-red-fg);
    border: 1px solid var(--status-red-fg);
}

.message-info {
    background: var(--status-yellow-bg);
    color: var(--status-yellow-fg);
    border: 1px solid var(--status-yellow-fg);
}

.message-warning {
    background: var(--status-yellow-bg);
    color: var(--status-yellow-fg);
    border: 1px solid var(--status-yellow-fg);
}

/* Stats Section - inline metrics, not cards */
.stats-section {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 28px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-light);
}

.stat-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 0 16px;
    border-left: 3px solid transparent;
}

.stat-item.accent-blue { border-left-color: var(--brand-blue); }
.stat-item.accent-red { border-left-color: var(--brand-red); }
.stat-item.accent-green { border-left-color: var(--status-green-fg); }
.stat-item.accent-yellow { border-left-color: var(--status-yellow-fg); }

.stat-value {
    font-family: 'Sora', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Table Section */
.table-section {
    margin-bottom: 24px;
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    box-shadow: 
        inset 2px 2px 5px var(--shadow-dark),
        inset -2px -2px 5px var(--shadow-light);
    flex: 1;
    max-width: 320px;
}

.search-wrapper input {
    border: none;
    background: transparent;
    outline: none;
    font-family: 'Work Sans', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: 'Work Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--brand-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 75, 147, 0.3);
}

.btn-primary:hover {
    background: var(--brand-blue-hover);
    box-shadow: 0 3px 12px rgba(0, 75, 147, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 
        2px 2px 5px var(--shadow-dark),
        -2px -2px 5px var(--shadow-light);
}

.btn-secondary:hover {
    box-shadow: 
        inset 2px 2px 5px var(--shadow-dark),
        inset -2px -2px 5px var(--shadow-light);
}

.btn-danger {
    background: var(--brand-red);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Table */
.table-wrapper {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    border: 1px solid var(--border-light);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th {
    font-family: 'Sora', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: left;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--shadow-dark);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-secondary);
}

tr:hover td {
    background: rgba(0, 75, 147, 0.03);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-good { background: var(--status-green-bg); color: var(--status-green-fg); }
.status-almost-expiring { background: var(--status-yellow-bg); color: var(--status-yellow-fg); }
.status-expired { background: var(--status-red-bg); color: var(--status-red-fg); }
.status-broken { background: var(--status-red-bg); color: var(--status-red-fg); }

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 6px;
}

.action-btn {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-light);
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--bg-secondary);
    color: var(--brand-blue);
}

/* Forms */
.form-container {
    max-width: 560px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    box-shadow: 
        inset 2px 2px 5px var(--shadow-dark),
        inset -2px -2px 5px var(--shadow-light);
    font-family: 'Work Sans', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--brand-blue);
    box-shadow: 
        inset 2px 2px 5px var(--shadow-dark),
        inset -2px -2px 5px var(--shadow-light),
        0 0 0 2px rgba(0, 75, 147, 0.2);
}

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

/* Pending Approval Section */
.pending-section {
    margin-bottom: 24px;
}

.pending-list {
    list-style: none;
}

.pending-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 12px;
}

.pending-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pending-actions {
    display: flex;
    gap: 8px;
}

/* Auth Pages */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-form {
    width: 100%;
    max-width: 420px;
    padding: 32px;
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo .logo-text {
    font-size: 28px;
}

.auth-title {
    font-family: 'Sora', sans-serif;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-link {
    color: var(--brand-blue);
    text-decoration: none;
    font-weight: 500;
}

.auth-link:hover {
    text-decoration: underline;
}

/* Mobile Responsive */
.mobile-toggle {
    display: none;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    cursor: pointer;
    box-shadow: 
        2px 2px 5px var(--shadow-dark),
        -2px -2px 5px var(--shadow-light);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 240px;
        padding: 18px 12px;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 24px rgba(0,0,0,0.25);
    }

    .main-content {
        margin-left: 0;
        padding: 14px;
    }

    .page-title {
        font-size: 20px;
    }

    .top-bar {
        gap: 10px;
        margin-bottom: 16px;
    }

    .stats-section {
        gap: 12px;
        padding: 10px 0;
    }

    .stat-item {
        padding: 0 8px;
    }

    .stat-value {
        font-size: 20px;
    }

    .table-toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .table-toolbar > form {
        flex: 1 1 100%;
    }

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

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }

    .form-input, .form-select, .form-textarea {
        padding: 9px 12px;
        font-size: 13px;
    }

    th, td {
        padding: 10px 10px;
        font-size: 13px;
    }

    .nav-item {
        padding: 10px 12px;
        font-size: 13px;
    }

    .logo-text {
        font-size: 18px;
    }

    .user-menu {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-title {
        font-size: 18px;
    }

    .btn {
        padding: 7px 12px;
        font-size: 12px;
    }

    .btn-sm {
        padding: 5px 8px;
        font-size: 11px;
    }

    .form-input, .form-select, .form-textarea {
        padding: 8px 10px;
        font-size: 12px;
    }

    th, td {
        padding: 8px 8px;
        font-size: 12px;
    }

    .nav-item {
        padding: 9px 10px;
        font-size: 12px;
    }

    .sidebar {
        width: 220px;
    }

    .stats-section {
        flex-direction: column;
        gap: 8px;
    }

    .stat-item {
        padding: 4px 8px;
    }

    .pending-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .action-btn {
        padding: 3px 6px;
    }

    .icon-sm {
        width: 14px;
        height: 14px;
    }
}


/* Mobile table improvements */
@media (max-width: 768px) {
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-md);
    }
    table {
        min-width: 100%;
    }
    th, td {
        white-space: nowrap;
        padding: 8px 10px;
        font-size: 12px;
    }
    th {
        font-size: 10px;
    }
}


/* Ensure toolbar buttons stay compact on mobile */
@media (max-width: 768px) {
    .table-toolbar {
        gap: 8px;
    }
    .table-toolbar > h2,
    .table-toolbar > div > h2 {
        font-size: 14px;
    }
    .table-toolbar .btn {
        white-space: nowrap;
    }
}


/* Ensure hamburger is far left on mobile */
@media (max-width: 768px) {
    .main-content {
        padding-left: 8px;
    }
    .top-bar-left {
        margin-left: 0;
        padding-left: 0;
    }
    .mobile-toggle {
        margin-left: 0;
        order: -1;
    }
    .top-bar {
        padding-left: 0;
    }
}


/* Prevent tables from expanding viewport */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}
.main-content {
    max-width: 100%;
    overflow-x: hidden;
}
.table-wrapper {
    max-width: 100%;
    overflow-x: auto;
}
table {
    min-width: 0;
}
@media (max-width: 1024px) {
    table {
        min-width: 600px;
    }
}


/* Mobile form controls - prevent text cutting */
@media (max-width: 768px) {
    .form-input,
    .form-select,
    .form-textarea {
        height: auto;
        min-height: 40px;
        line-height: 1.4;
        padding: 10px 12px;
        font-size: 13px;
    }
    .btn {
        height: auto;
        min-height: 36px;
        line-height: 1.3;
        white-space: nowrap;
    }
    .btn-sm {
        min-height: 30px;
        padding: 6px 10px;
    }
    .search-wrapper {
        min-height: 42px;
    }
    .search-wrapper input {
        font-size: 13px;
    }
    .table-toolbar form {
        gap: 8px;
    }
    .table-toolbar .form-select,
    .table-toolbar .form-input {
        min-width: 120px;
    }
}


/* Filter bar */
.filter-bar {
    padding: 12px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin-top: 12px;
}
.filter-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-form .search-wrapper {
    flex: 1 1 240px;
    max-width: 320px;
}
.filter-form .filter-select {
    min-width: 160px;
    max-width: 200px;
}
.filter-form .date-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}
.filter-form .date-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.filter-form .date-field input {
    padding: 9px 10px;
    font-size: 13px;
}
.filter-form .btn {
    align-self: flex-end;
}

@media (max-width: 768px) {
    .filter-form {
        gap: 8px;
    }
    .filter-form .search-wrapper {
        flex: 1 1 100%;
        max-width: none;
    }
    .filter-form .filter-select {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        max-width: none;
    }
    .filter-form .date-field {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }
    .filter-form .date-field input {
        width: 100%;
        font-size: 12px;
        padding: 8px 8px;
    }
    .filter-form .date-field label {
        font-size: 10px;
    }
    .filter-form .btn {
        flex: 0 0 auto;
    }
}


/* Uniform filter buttons */
.filter-form .btn {
    min-width: 80px;
    justify-content: center;
    flex: 0 0 auto;
}


/* Force uniform button heights in filter bars */
.filter-form .btn,
.table-toolbar .btn,
.btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-sizing: border-box;
}
.btn-sm {
    min-height: 34px;
    line-height: 1;
}
