/* === DESIGN TOKENS === */
:root {
    --primary: #047857;
    --primary-light: #10b981;
    --primary-dark: #065f46;
    --primary-glow: rgba(4, 120, 87, 0.15);
    --sidebar-width: 260px;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-card: 0 4px 24px rgba(0,0,0,0.07);
    --shadow-modal: 0 20px 60px rgba(0,0,0,0.18);
}

/* === BASE === */
body {
    font-family: 'Sarabun', 'Inter', sans-serif;
    background: #f0fdf4;
    color: #1a202c;
}

/* === SIDEBAR === */
.sidebar-gradient {
    background: linear-gradient(180deg, #047857 0%, #065f46 60%, #064e3b 100%);
    box-shadow: 4px 0 24px rgba(4, 120, 87, 0.25);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
}

.sidebar-logo h2 {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}

.sidebar-logo small {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.6);
    font-weight: 400;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    margin-bottom: 2px;
    position: relative;
}

.sidebar-nav-item:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-nav-item.active {
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.sidebar-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #6ee7b7;
    border-radius: 0 3px 3px 0;
}

.sidebar-nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: background 0.2s;
}

.sidebar-nav-item.active .sidebar-nav-icon {
    background: rgba(110, 231, 183, 0.2);
}

/* User Info in Sidebar */
.sidebar-user-card {
    margin: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
}

.sidebar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6ee7b7, #10b981);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #064e3b;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.3);
}

/* === STAT SUMMARY CARDS (top of sidebar) === */
.sidebar-stats {
    margin: 0 12px 8px;
}

.sidebar-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.sidebar-stat-item {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 8px 10px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
}

.sidebar-stat-item .stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
    color: #fff;
}

.sidebar-stat-item .stat-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.65);
    margin-top: 2px;
}

/* === HEADER === */
.main-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 8px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 30;
}

.header-title-section h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1;
}

.header-breadcrumb {
    font-size: 0.72rem;
    color: #9ca3af;
    margin-top: 2px;
}

.pending-badge {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.4); }
    50% { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
}

/* === TOOLBAR === */
.toolbar-section {
    background: #fff;
    border-bottom: 1px solid #f3f4f6;
    padding: 14px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: #fff;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.88rem;
    min-width: 180px;
    color: #374151;
}

.filter-select {
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 14px;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.88rem;
    color: #374151;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

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

/* === EQUIPMENT CARDS === */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    padding: 24px;
}

.equipment-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1.5px solid #e5e7eb;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-card);
}

.equipment-card:hover {
    transform: translateY(-6px);
    border-color: #a7f3d0;
    box-shadow: 0 16px 40px rgba(4, 120, 87, 0.12), 0 4px 12px rgba(0,0,0,0.06);
}

.equipment-card-img {
    position: relative;
    height: 160px;
    background: linear-gradient(135deg, #f0fdf4, #d1fae5);
    overflow: hidden;
}

.equipment-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.equipment-card:hover .equipment-card-img img {
    transform: scale(1.05);
}

/* NO IMAGE placeholder */
.equipment-card-img .no-img {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #a7f3d0;
    gap: 6px;
}

.equipment-card-img .no-img i {
    font-size: 2.5rem;
}

.equipment-card-img .no-img span {
    font-size: 0.7rem;
    color: #6ee7b7;
}

/* Status Badge */
.status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    letter-spacing: 0.02em;
}

.status-badge.available {
    background: rgba(16, 185, 129, 0.92);
    color: #fff;
}

.status-badge.borrowed {
    background: rgba(239, 68, 68, 0.92);
    color: #fff;
}

.status-badge.pending-borrow {
    background: rgba(245, 158, 11, 0.95);
    color: #fff;
    animation: pulse-status 1.8s infinite;
}

.status-badge.pending-return {
    background: rgba(249, 115, 22, 0.95);
    color: #fff;
    animation: pulse-status 1.8s infinite;
}

@keyframes pulse-status {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

/* Admin overlay buttons */
.admin-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
}

.equipment-card:hover .admin-overlay {
    opacity: 1;
}

.admin-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: none;
    cursor: pointer;
    transition: transform 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.admin-btn:hover { transform: scale(1.1); }
.admin-btn.edit { background: #fbbf24; color: #fff; }
.admin-btn.delete { background: #ef4444; color: #fff; }

/* Card Body */
.equipment-card-body {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.card-category {
    font-size: 0.68rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-asset-id {
    background: #f3f4f6;
    color: #374151;
    padding: 2px 7px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid #e5e7eb;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 10px;
    line-height: 1.3;
}

.card-borrower-info {
    background: #f9fafb;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 0.78rem;
    color: #6b7280;
}

.card-borrower-info p { margin: 1px 0; }
.card-borrower-info b { color: #374151; }

/* Card Actions */
.card-actions {
    margin-top: auto;
}

.card-admin-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    padding: 8px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #047857, #10b981);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(4, 120, 87, 0.35);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.btn-return {
    width: 100%;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-return:hover {
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
    transform: translateY(-1px);
}

.btn-approve {
    flex: 1;
    background: linear-gradient(135deg, #10b981, #047857);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-reject {
    flex: 1;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-approve:hover, .btn-reject:hover { opacity: 0.9; transform: scale(0.98); }

/* === LOGIN PAGE === */
.login-gradient {
    background: linear-gradient(135deg, #047857 0%, #065f46 40%, #064e3b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.login-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(110, 231, 183, 0.08) 0%, transparent 60%);
    animation: loginBgPulse 6s ease-in-out infinite;
}

@keyframes loginBgPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.login-card {
    background: rgba(255,255,255,0.97);
    border-radius: 20px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.1);
    padding: 36px 32px;
    max-width: 380px;
    width: 100%;
    position: relative;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.5);
}

.login-icon-ring {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #047857, #10b981);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.6rem;
    color: #fff;
    box-shadow: 0 8px 24px rgba(4, 120, 87, 0.4);
}

.input-field {
    width: 100%;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 11px 14px;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

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

.login-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #047857, #10b981);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(4, 120, 87, 0.3);
}

.login-submit-btn:hover {
    box-shadow: 0 8px 24px rgba(4, 120, 87, 0.4);
    transform: translateY(-1px);
}

/* === MODALS === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid #e5e7eb;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f3f4f6;
}

.modal-header-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a202c;
}

.modal-input-group {
    margin-bottom: 14px;
}

.modal-input-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

.modal-input-group .input-field {
    margin-bottom: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid #f3f4f6;
}

.btn-cancel {
    padding: 9px 18px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-cancel:hover { background: #e5e7eb; }

.btn-confirm {
    padding: 9px 18px;
    background: linear-gradient(135deg, #047857, #10b981);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Sarabun', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(4, 120, 87, 0.3);
}

.btn-confirm:hover {
    box-shadow: 0 4px 16px rgba(4, 120, 87, 0.4);
    transform: translateY(-1px);
}

.btn-confirm-blue {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.btn-confirm-blue:hover { box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4); }

/* === CHECKLIST SECTION === */
.checklist-section {
    background: linear-gradient(135deg, #fff7ed, #fffbeb);
    border: 1.5px solid #fde68a;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.checklist-section .section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.85rem;
    color: #374151;
}

.custom-checkbox {
    accent-color: #047857;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* === HISTORY TABLE === */
.history-table-wrap {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.history-table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.history-table thead th {
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.history-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}

.history-table tbody tr:last-child { border-bottom: none; }
.history-table tbody tr:hover { background: #f9fafb; }

.history-table td { padding: 12px 20px; vertical-align: middle; }

/* === STATS PAGE === */
.stat-toplevel-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid #e5e7eb;
    text-align: center;
    border-top: 3px solid transparent;
    transition: transform 0.2s;
}

.stat-toplevel-card:hover { transform: translateY(-3px); }

/* === ANIMATIONS === */
.fade-in {
    animation: fadeIn 0.4s ease-in-out;
}

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

.card-hover { transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(4, 120, 87, 0.1);
}

@keyframes pulse-yellow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.bg-pulse-yellow { animation: pulse-yellow 1.5s infinite; }

.label-badge {
    background-color: #f3f4f6;
    color: #374151;
    padding: 2px 7px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 0.68rem;
    border: 1px solid #e5e7eb;
}

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

.sidebar-slide-in { animation: slideIn 0.28s ease-out; }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-state i { font-size: 3rem; color: #d1fae5; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* === RESPONSIVE === */
@media (max-width: 767px) {
    .equipment-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
        padding: 14px;
    }
    .toolbar-section { padding: 12px 14px; }
}
