/* --- style.css --- */
body {
    font-family: 'Inter', sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: #111827;
    color: #d1d5db;
    margin: 0;
    padding: 1rem; /* Adjusted for mobile */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.container, .login-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem; /* Adjusted for mobile */
    flex-grow: 1;
}
header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid #374151; }
header h1 { font-size: 1.25rem; font-weight: 600; color: #fff; margin-right: 1rem; }
.logo { height: 32px; }
.card { background-color: #1f2937; border: 1px solid #374151; border-radius: 0.75rem; padding: 1.5rem; margin-bottom: 2rem; }
.card h2 { margin-top: 0; font-size: 1.25rem; color: #fff; border-bottom: 1px solid #374151; padding-bottom: 0.75rem; margin-bottom: 1.5rem; }
.table-wrapper { overflow-x: auto; overflow-y: visible; position: relative; }
/* Allow tooltips to escape the collapsed border context */
.table-wrapper table { border-collapse: separate; border-spacing: 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; min-width: 1000px; }
/* Allow tooltips to overflow beyond table bounds by avoiding collapsed borders */
.table-wrapper table { border-collapse: separate !important; border-spacing: 0; }
th, td { padding: 0.75rem 0.75rem; text-align: left; border-bottom: 1px solid #374151; }
th { color: #9ca3af; text-transform: uppercase; font-size: 0.75rem; }
.table-wrapper table, .table-wrapper thead, .table-wrapper th { overflow: visible; position: relative; }
thead th .tooltip { position: relative; z-index: 100; }
.sort-link { color:#ffffff !important; font-weight:700; text-decoration:none !important; display:inline-flex; align-items:center; gap:0.25rem; font-family: inherit; }
.sort-link:hover { text-decoration:none !important; }
.sort-arrow { color:#9ca3af; margin-left:0.25rem; }
td.key { display: flex; align-items: center; gap: 0.5rem; font-family: monospace; font-size: 0.8rem; color: #9ca3af; }
td.key .key-text { flex: 1; word-break: break-all; }
div.copy-field { display: flex; align-items: center; gap: 0.5rem; }
div.copy-field input { flex: 1; min-width: 0; }
button.copy-key-btn {
    background-color: transparent !important;
    border: none !important;
    color: #9ca3af !important;
    padding: 0.25rem !important;
    border-radius: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
    line-height: 0;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}
button.copy-key-btn .icon { width: 14px; height: 14px; }
button.copy-key-btn:hover,
button.copy-key-btn:focus {
    color: #ffffff !important;
    background-color: rgba(59, 130, 246, 0.18) !important;
    outline: none;
}
button.copy-key-btn:active { transform: scale(0.95); }
button.copy-key-btn.copied { color: #10b981 !important; background-color: rgba(16, 185, 129, 0.18) !important; }
button.copy-key-btn.copy-error { color: #f87171 !important; background-color: rgba(248, 113, 113, 0.18) !important; }
td small { color: #6b7280; }
.status { padding: 0.25rem 0.5rem; border-radius: 9999px; font-weight: 600; font-size: 0.75rem; }
.status.active { background-color: #10b981; color: #064e3b; }
.status.inactive { background-color: #ef4444; color: #7f1d1d; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.actions .btn-action, .actions form button { font-size: 0.75rem; padding: 0.25rem 0.75rem; margin-right: 0; text-decoration: none; display: inline-block; }
button, .btn-action { background-color: #3b82f6; color: white; border: none; padding: 0.6rem 1.2rem; border-radius: 0.5rem; font-weight: 600; cursor: pointer; transition: background-color 0.2s; }
.login-container button[type="submit"] { margin-top: 1.5rem; }
button:hover, .btn-action:hover { background-color: #2563eb; }

/* Loading state for action buttons */
.btn-action.btn-loading,
button.btn-loading { position: relative; opacity: 0.85; pointer-events: none; }
.btn-action.btn-loading::after,
button.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 16px; height: 16px;
    margin-top: -8px; margin-left: -8px;
    border: 2px solid rgba(255,255,255,0.5);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: btnSpin .8s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }
button.danger, .btn-action.danger { background-color: #dc2626; }
button.danger:hover, .btn-action.danger:hover { background-color: #b91c1c; }
.add-form { display: flex; flex-direction: column; gap: 1rem; }
.add-form button { width: 100%; }
.add-form .btn-add-user { width: auto !important; align-self: flex-start; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
    width: 100%;
    box-sizing: border-box;
    background-color: #111827 !important;
    border: 1px solid #4b5563;
    color: white !important;
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    font-family: inherit;
    color-scheme: dark;
}

/* Make number inputs look like other text inputs (hide spinners) */
input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none; /* Chrome/Safari */
    margin: 0;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: brightness(0) invert(1);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3b82f6;
}
/* Changelog entries layout (scoped) */
#changelog-public .version, #changelog-manage .version { margin-bottom: 1rem; }
#changelog-public .entries, #changelog-manage .entries { margin-left: 1.5rem; border-left: 2px solid #374151; padding-left: 1.5rem; }
#changelog-public .entry, #changelog-manage .entry { display: flex; align-items: flex-start; padding: 0.75rem 0; gap: 0.5rem; }
/* Text block in public view is just the description */
#changelog-public .entry-content { display: block; flex: 1 1 auto; min-width: 0; margin-left: 0.5rem; white-space: normal; }
/* Manage view uses a wrapper for badges + text */
#changelog-manage .entry-content { display: flex; align-items: flex-start; flex: 1 1 auto; min-width: 0; }
/* Prevent badges from shrinking and being overlaid by text */
#changelog-public .entry-type-badge, #changelog-manage .entry-type-badge { flex: 0 0 auto; }
#changelog-public .module-badges, #changelog-manage .module-badges { flex: 0 0 auto; align-items: center; }
#changelog-public .entry-actions, #changelog-manage .entry-actions { display: flex; gap: 0.5rem; margin-left: 1rem; flex-shrink: 0; }
#changelog-public .entry-type-badge, #changelog-manage .entry-type-badge { font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; margin-right: 0.75rem; text-transform: uppercase; flex-shrink: 0; margin-top: 2px; }
#changelog-public .entry-type-badge.added, #changelog-manage .entry-type-badge.added { background-color: #10b981; color: #064e3b; }
#changelog-public .entry-type-badge.fixed, #changelog-manage .entry-type-badge.fixed { background-color: #f59e0b; color: #78350f; }
#changelog-public .entry-type-badge.removed, #changelog-manage .entry-type-badge.removed { background-color: #6b7280; color: #1f2937; }
#changelog-public .entry-module-badge, #changelog-manage .entry-module-badge { font-size: 0.70rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 999px; margin-right: 0.5rem; background-color: #374151; color: #e5e7eb; text-transform: none; flex-shrink: 0; margin-top: 2px; }
#changelog-public .module-badges, #changelog-manage .module-badges { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
/* Accordion components (scoped) */
#changelog-public .accordion-item, #changelog-manage .accordion-item { border: 1px solid #374151; border-radius: 0.5rem; background-color: #1f2937; }
#changelog-public .accordion-header, #changelog-manage .accordion-header { width: 100%; text-align: left; background-color: transparent !important; border: none !important; color: #fff !important; padding: 0.9rem 1rem; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 600; border-radius: 0 !important; box-shadow: none !important; }
#changelog-public .accordion-header:hover, #changelog-manage .accordion-header:hover { background-color: #111827; }
#changelog-public .accordion-title, #changelog-manage .accordion-title { font-size: 1rem; }
#changelog-public .accordion-indicator::before, #changelog-manage .accordion-indicator::before { content: '▸'; display: inline-block; transition: transform 0.25s ease; }
#changelog-public .accordion-header[aria-expanded="true"] .accordion-indicator::before, #changelog-manage .accordion-header[aria-expanded="true"] .accordion-indicator::before { content: '▾'; }
#changelog-public .accordion-content, #changelog-manage .accordion-content { overflow: hidden; max-height: 0; opacity: 0; transition: max-height 0.35s ease, opacity 0.3s ease; padding: 0 1rem; }
#changelog-public .accordion-content.open, #changelog-manage .accordion-content.open { opacity: 1; padding-bottom: 1rem; }

/* Manage-page accordion variant */
#changelog-manage .version { border: 1px solid #374151; border-radius: 0.5rem; background-color: #1f2937; }
#changelog-manage .version-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; cursor: pointer; padding: 0.9rem 1rem; }
#changelog-manage .version-header:hover { background-color: #111827; }
#changelog-manage .version.collapsed .version-header .accordion-indicator::before { transform: rotate(-90deg); }

/* Floating toast */
.floating-alert { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 10000; max-width: 90vw; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.4); }
.alert.fade-out { opacity: 0; transition: opacity 0.5s ease-out; }

#changelog-manage .edit-form { display: none; margin-top: 1rem; background-color: #111827; padding: 1rem; border-radius: 0.5rem; }
#changelog-manage .edit-form textarea { width: 100%; box-sizing: border-box; }
#changelog-manage .edit-form .inline-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0.75rem; }
@media (max-width: 640px) { #changelog-manage .edit-form .inline-selects { grid-template-columns: 1fr; } }

/* Multi-select dropdown (scoped to manage) */
#changelog-manage .multi-select { position: relative; }
#changelog-manage .multi-select-toggle { width: 100%; background-color: #111827; border: 1px solid #4b5563; color: #fff; padding: 0.6rem 1rem; border-radius: 0.5rem; text-align: left; cursor: pointer; }
#changelog-manage .multi-select-menu { position: absolute; z-index: 50; background-color: #111827; border: 1px solid #4b5563; border-radius: 0.5rem; padding: 0.5rem; min-width: 280px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.4); margin-top: 0.25rem; display: none; }
#changelog-manage .multi-select.open .multi-select-menu { display: block; }
#changelog-manage .multi-select-menu label { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.4rem; border-radius: 0.375rem; cursor: pointer; }
#changelog-manage .multi-select-menu label:hover { background-color: #1f2937; }
/* Slightly increase spacing for edit-form dropdowns */
.edit-form select {
    margin-right: 0.5rem;
}
.edit-form select:last-of-type {
    margin-right: 0;
}
.edit-form select option {
    padding: 0.35rem 0.5rem; /* visual separation inside dropdown */
}

/* Manage changelog: top add-entry form layout (match previous working layout) */
#changelog-manage .add-form { max-width: none; }
#changelog-manage .add-form .inline-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
@media (max-width: 640px) { #changelog-manage .add-form .inline-selects { grid-template-columns: 1fr; } }
#changelog-manage .add-form select { width: 100%; }
#changelog-manage .add-form .multi-select-toggle { width: 100%; }
#changelog-manage .add-form .form-actions { display: flex; justify-content: flex-start; margin-top: 1rem; }
#changelog-manage .add-form button[type="submit"] { width: auto; }

/* Ensure add-entry form groups align and inputs fill width */
#changelog-manage .add-form .form-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
#changelog-manage .add-form .form-group { display: flex; flex-direction: column; }
#changelog-manage .add-form input[type="text"],
#changelog-manage .add-form input[type="date"],
#changelog-manage .add-form input[type="number"],
#changelog-manage .add-form select,
#changelog-manage .add-form textarea { width: 100%; }

/* Header action button in Add Changelog card */
#changelog-manage .card .flex-between { display:flex; align-items:center; justify-content:space-between; }
#changelog-manage .card .flex-between .inline-form { display: inline-flex; margin-left: auto; }
#changelog-manage .card .flex-between .inline-form .btn-secondary { background-color: #4b5563; color: #ffffff; }
input.readonly { background-color: #374151; cursor: not-allowed; }
.logout-btn { background-color: #4b5563; color: white; padding: 0.5rem 1rem; border-radius: 0.5rem; text-decoration: none; font-size: 0.875rem; font-weight: 600; }
.logout-btn:hover { background-color: #6b7280; }
.login-wrapper { display: flex; flex-direction: column; min-height: 100vh; justify-content: center; }
.login-container { max-width: 400px; width: 100%; margin: 0 auto; background-color: #1f2937; padding: 2rem; border-radius: 0.75rem; text-align: center; }
.login-container h2 { color: #fff; margin-top: 1.5rem; margin-bottom: 1.5rem; }
.login-container .error { color: #f87171; margin-top: 1rem; }
.login-info { margin-top: 1rem; padding: 1rem; background-color: #111827; border-radius: 0.5rem; border: 1px solid #374151; }
.login-info p { margin: 0.25rem 0; font-size: 0.875rem; }
.login-info strong { color: #10b981; }
.login-info em { color: #f59e0b; }
.password-reset-info { margin-top: 2rem; padding: 1rem; background-color: #111827; border-radius: 0.5rem; border: 1px solid #374151; }
.password-reset-info p { margin: 0; font-size: 0.875rem; color: #9ca3af; text-align: center; }
.edit-form .form-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.edit-form .form-group { display: flex; flex-direction: column; }
.edit-form .form-group label { margin-bottom: 0.5rem; font-size: 0.875rem; color: #9ca3af; font-weight: 500; }
.edit-form .form-actions { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.edit-form .form-actions button { width: 100%; }
/* Inline layout for edit entry selects */
.edit-form .inline-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
@media (max-width: 640px) {
    .edit-form .inline-selects { grid-template-columns: 1fr; }
}
.footer { text-align: center; padding: 1.5rem; color: #6b7280; font-size: 0.875rem; }
.footer .support-link { color: #9ca3af; text-decoration: none; }
.footer .support-link:hover { text-decoration: underline; color: #3b82f6; }

/* Utilities (shared across pages)
   Used by: index.php, manage_users.php, manage_changelog.php, changelog.php */
.flex-row-center { display:flex; align-items:center; gap: 1rem; }
.flex-between { display:flex; align-items:center; justify-content:space-between; gap: 1rem; }
.m-0 { margin: 0 !important; }
.ml-05 { margin-left: 0.5rem !important; }
.grid-1 { display:grid; grid-template-columns: 1fr; gap: 1rem; }
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Timezone legend and info icon */
.time-legend {
    color: #9ca3af;
    font-size: 0.8rem;
    margin: 0.25rem 0 0.75rem 0;
}
.time-legend code { color: #d1d5db; }
.time-legend em { color: #d1d5db; }
.info-icon {
    color: #9ca3af;
    cursor: help;
    margin-left: 4px;
}

/* Tooltip */
.tooltip { position: relative; display: inline-block; }
/* Portal-based tooltip (appended to body) */
.tooltip-portal {
    position: fixed;
    background: #111827;
    color: #d1d5db;
    border: 1px solid #374151;
    padding: 0.5rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
    min-width: 220px;
    max-width: 320px;
    white-space: normal;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.4);
    z-index: 99999;
    pointer-events: none;
}

/* User Profile Styles */
.user-profile { 
    display: flex; 
    flex-direction: column; 
    align-items: flex-end; 
    gap: 0.75rem; 
}

.user-info { 
    text-align: right; 
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.user-name { display: block; font-weight: 600; color: #fff; font-size: 0.875rem; }
.user-role { display: block; font-size: 0.75rem; color: #9ca3af; text-transform: uppercase; }
.user-actions { display: flex; gap: 0.5rem; }
.btn-profile { background-color: #6b7280; color: white; padding: 0.5rem 1rem; border-radius: 0.5rem; text-decoration: none; font-size: 0.875rem; font-weight: 600; }
.btn-profile:hover { background-color: #9ca3af; }
.card-header-bar { display:flex; justify-content: space-between; align-items:center; gap:1rem; }
.search-inline { display:flex; align-items:center; gap:0.5rem; position: relative; margin-left: auto; }
.search-input { width:0; opacity:0; pointer-events:none; transition: all .2s ease; background-color:#111827; border:1px solid #4b5563; color:#fff; border-radius:0.5rem; padding:0.5rem 0.75rem; }
.search-inline.open .search-input { width:220px; opacity:1; pointer-events:auto; }
.search-btn { display:inline-flex; align-items:center; gap:0.25rem; }
.btn-primary { background-color: #10b981; color: white; padding: 0.6rem 1.2rem; border-radius: 0.5rem; text-decoration: none; font-size: 0.875rem; font-weight: 600; display: inline-block; }
.btn-primary:hover { background-color: #059669; }
/* Form action row aligned to end (used by manage_changelog.php inline editors) */
.form-actions-end { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

/* Buttons - secondary/neutral (e.g., Cancel)
   Used by: manage_changelog.php */
.btn-secondary { background-color: #4b5563; color: white; padding: 0.6rem 1.2rem; border-radius: 0.5rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-secondary:hover { background-color: #6b7280; }

/* Navigation styling */
nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid #374151;
}

/* License Server Main Navigation */
nav:not(#sidebar nav) .nav-link {
    background-color: #374151;
    color: #d1d5db;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

nav:not(#sidebar nav) .nav-link:hover {
    background-color: #4b5563;
    color: #fff;
    border-color: #6b7280;
}

nav:not(#sidebar nav) .nav-link.active {
    background-color: #3b82f6;
    color: #fff;
    border-color: #2563eb;
}

/* Inline utilities */
.inline-form { display: inline; }
.inline-flex-center { display: inline-flex; align-items: center; }



/* Form Improvements */
.checkbox-group { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.checkbox-group label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: auto; margin: 0; }
.action-buttons { margin-top: 1rem; }

/* User Management Improvements */
.btn-add-user { 
    width: auto !important; 
    padding: 0.5rem 1.5rem !important; 
    font-size: 0.875rem !important; 
    align-self: flex-start; 
}

/* Form Layout Improvements */
.add-form {
    max-width: 800px;
}

/* Logs page specific form improvements */
.card .add-form .form-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card .add-form .form-group {
    margin-bottom: 0;
}

.card .add-form .actions {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.card .add-form .actions .btn-action {
    flex: 0 0 auto;
}

/* Responsive form adjustments */
@media (max-width: 767px) {
    .add-form {
        max-width: 100%;
    }
}
.form-help { 
    background-color: #111827; 
    border: 1px solid #374151; 
    border-radius: 0.5rem; 
    padding: 1rem; 
    margin-bottom: 1rem; 
    font-size: 0.875rem; 
}
.form-help p { 
    margin: 0.25rem 0; 
    color: #9ca3af; 
}
.form-help strong { 
    color: #3b82f6; 
}
.permissions-label { 
    font-weight: 600; 
    color: #fff; 
    margin-bottom: 0.5rem; 
}
.checkbox-label { 
    display: flex !important; 
    align-items: center; 
    gap: 0.5rem; 
    font-size: 0.875rem; 
    cursor: pointer; 
    margin: 0; 
}
.checkbox-label input[type="checkbox"] { 
    width: auto !important; 
    margin: 0; 
}

/* Alert Messages */
.alert { padding: 1rem; border-radius: 0.5rem; margin-bottom: 1rem; font-weight: 500; }
.alert.success { background-color: #10b981; color: #064e3b; border: 1px solid #059669; }
.alert.error { background-color: #ef4444; color: #7f1d1d; border: 1px solid #dc2626; }

/* Profile Information */
.profile-info p { margin: 0.5rem 0; padding: 0.5rem 0; border-bottom: 1px solid #374151; }
.profile-info p:last-child { border-bottom: none; }
.permissions-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.permission-tag { background-color: #3b82f6; color: white; padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }

/* Modal Styles */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); }
.modal-content { background-color: #1f2937; margin: 5% auto; padding: 2rem; border: 1px solid #374151; border-radius: 0.75rem; width: 90%; max-width: 600px; position: relative; }
.close { color: #9ca3af; float: right; font-size: 2rem; font-weight: bold; cursor: pointer; line-height: 1; }
.close:hover { color: #fff; }

/* Modal form improvements */
.modal .edit-form .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.modal .edit-form .form-actions {
    margin-top: 1rem;
}

/* Password requirements styling */
.password-requirements {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: #282a36;
    border: 1px solid #374151;
    border-radius: 0.5rem;
}

.password-requirements h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.8rem;
    color: #f8f8f2;
    font-weight: 500;
}

.requirement-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
}

.requirement-item:last-child {
    margin-bottom: 0;
}

.requirement-item input[type="checkbox"] {
    margin-right: 0.4rem;
    width: auto;
    height: auto;
    transform: scale(0.9);
    accent-color: #6272a4;
}

.requirement-item label {
    margin: 0;
    color: #ff5555;
    cursor: default;
    line-height: 1.2;
}

.requirement-item input[type="checkbox"]:checked + label {
    color: #10b981;
}

.requirement-item input[type="checkbox"]:not(:checked) + label {
    color: #ff5555;
}

/* Compact password requirements for modals and smaller forms */
.modal .password-requirements,
.add-form .password-requirements {
    margin-top: 0.4rem;
    padding: 0.6rem;
    background-color: #282a36;
}

.modal .password-requirements h4,
.add-form .password-requirements h4 {
    margin: 0 0 0.4rem 0;
    font-size: 0.75rem;
    color: #f8f8f2;
}

.modal .requirement-item,
.add-form .requirement-item {
    margin-bottom: 0.2rem;
    font-size: 0.75rem;
}

.modal .requirement-item input[type="checkbox"],
.add-form .requirement-item input[type="checkbox"] {
    margin-right: 0.3rem;
    transform: scale(0.85);
    accent-color: #6272a4;
}

/* Ultra-compact horizontal layout for add user form */
.add-form .password-requirements {
    margin-top: 0.3rem;
    padding: 0.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.3rem 1rem;
    align-items: start;
    background-color: #282a36;
}

.add-form .password-requirements h4 {
    grid-column: 1 / -1;
    margin: 0 0 0.3rem 0;
    font-size: 0.7rem;
    text-align: center;
    border-bottom: 1px solid #374151;
    padding-bottom: 0.2rem;
    color: #f8f8f2;
}

.add-form .requirement-item {
    margin-bottom: 0.15rem;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
}

.add-form .requirement-item input[type="checkbox"] {
    margin-right: 0.25rem;
    transform: scale(0.8);
    accent-color: #6272a4;
}

.add-form .requirement-item label {
    color: #ff5555;
}

.add-form .requirement-item input[type="checkbox"]:checked + label {
    color: #10b981;
}

/* Responsive: stack vertically on smaller screens */
@media (max-width: 768px) {
    .add-form .password-requirements {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
}

/* Logs page specific styling */
.logs-table {
    margin-top: 1rem;
    width: 100%;
    min-width: 1200px;
}

.logs-table th {
    background-color: #374151;
    color: #f9fafb;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem 0.75rem;
    white-space: nowrap;
}

.logs-table td {
    vertical-align: top;
    padding: 1rem 0.75rem;
    word-wrap: break-word;
    max-width: 0;
}

/* Logs table fixed column widths (used by view_logs.php header) */
.logs-table th.col-user { width: 18%; }
.logs-table th.col-action { width: 12%; }
.logs-table th.col-details { width: 40%; }
.logs-table th.col-ip { width: 15%; }
.logs-table th.col-time { width: 15%; }

.logs-table tr:hover {
    background-color: #374151;
}

.logs-table small {
    color: #9ca3af;
    line-height: 1.4;
    display: block;
    margin-top: 0.25rem;
}

.logs-table .status.inactive {
    background-color: #ef4444;
    color: #7f1d1d;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Ensure Show More button is properly styled */
.actions .btn-action {
    display: inline-block !important;
    text-decoration: none !important;
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.875rem;
}

.actions .btn-action:hover {
    background-color: #2563eb;
    text-decoration: none !important;
}

.actions .btn-action.danger {
    background-color: #dc2626;
}

.actions .btn-action.danger:hover {
    background-color: #b91c1c;
}

/* Improve table wrapper for better horizontal scrolling */
.table-wrapper {
    overflow-x: auto;
    border-radius: 0.5rem;
    border: 1px solid #374151;
    background-color: #1f2937;
}

/* Better spacing for logs page cards */
.card {
    background-color: #1f2937;
    border: 1px solid #374151;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.card h2 {
    margin-top: 0;
    font-size: 1.25rem;
    color: #fff;
    border-bottom: 1px solid #374151;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Additional logs page improvements */
.card p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #d1d5db;
}

.card p:last-child {
    margin-bottom: 0;
}

.card strong {
    color: #f9fafb;
}

/* Improve form spacing on logs page */
.card .add-form {
    margin-top: 1rem;
}

.card .add-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #e5e7eb;
}

.card .add-form .form-group input,
.card .add-form .form-group select {
    width: 100%;
    box-sizing: border-box;
}

/* Responsive improvements for logs page */
@media (max-width: 1200px) {
    .logs-table {
        min-width: 1000px;
    }
    
    .card .add-form .form-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    .card .add-form .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .logs-table {
        min-width: 800px;
    }
}

/* Alternative: ultra-compact inline layout */
.password-requirements.inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.4rem;
    margin-top: 0.25rem;
    background-color: #282a36;
}

.password-requirements.inline h4 {
    margin: 0;
    font-size: 0.7rem;
    color: #f8f8f2;
    margin-right: 0.5rem;
}

.password-requirements.inline .requirement-item {
    margin: 0;
    font-size: 0.65rem;
    white-space: nowrap;
}

.password-requirements.inline .requirement-item input[type="checkbox"] {
    margin-right: 0.2rem;
    transform: scale(0.75);
    accent-color: #6272a4;
}

.password-requirements.inline .requirement-item label {
    color: #ff5555;
}

.password-requirements.inline .requirement-item input[type="checkbox"]:checked + label {
    color: #10b981;
}

/* Medium screens and up */
@media (min-width: 768px) {
    body {
        padding: 2rem;
    }
    .container {
        padding: 2rem;
        max-width: 1400px;
    }
    header h1 {
        font-size: 1.5rem;
    }
    .logo {
        height: 40px;
    }
    .add-form {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    .add-form button {
        grid-column: -1 / -2;
        width: auto;
    }
    .edit-form .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    .edit-form .form-actions {
        flex-direction: row;
        justify-content: space-between;
    }
    .edit-form .form-actions button {
        width: auto;
    }
    .user-profile {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }
}

/* Large screens and up */
@media (min-width: 1200px) {
    .container {
        max-width: 1600px;
    }
    table {
        min-width: 1200px;
    }
}

/* ========================================
   Documentation Page Styles
   ======================================== */

/* Sidebar and Navigation Styles */
#sidebar {
    background-color: #111827 !important;
    border-right: 1px solid #374151 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
}

/* Ensure Overview section is properly positioned for intersection observer */
#overview {
    scroll-margin-top: 20px !important;
}

#sidebar #nav-menu {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.125rem !important;
}

#sidebar #nav-menu a {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    /* Debug: ensure vertical layout */
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
}

#sidebar .nav-link {
    display: block !important;
    padding: 0.75rem 1rem !important;
    border-left: 2px solid transparent !important;
    color: #9ca3af !important;
    transition: all 0.2s !important;
    text-decoration: none !important;
    margin-bottom: 0.125rem !important;
    border-radius: 0.375rem !important;
    background-color: transparent !important;
    border: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    float: none !important;
    clear: both !important;
}

#sidebar .nav-link:hover {
    color: #e5e7eb !important;
    border-left-color: #6b7280 !important;
    background-color: rgba(75, 85, 99, 0.1) !important;
}

#sidebar .nav-link.active {
    color: #ffffff !important;
    font-weight: 600 !important;
    border-left-color: #3b82f6 !important;
    background-color: rgba(59, 130, 246, 0.1) !important;
}

/* Code Block Styles */
.code-block {
    background-color: #1f2937;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 1rem;
    position: relative;
    margin-bottom: 1rem;
}

.code-block pre {
    overflow-x: auto;
    white-space: pre;
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background-color: #374151;
    color: #d1d5db;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 10;
}

.copy-btn:hover {
    background-color: #4b7280;
}

/* Search Highlight Styles */
.search-highlight {
    background-color: #fde047;
    color: #1f2937;
    border-radius: 3px;
    padding: 0 2px;
    animation: highlightPulse 0.6s ease-in-out;
}

@keyframes highlightPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Floating Search Box Styles */
#floating-search {
    transition: all 0.3s ease;
}

#floating-search.scrolled {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 0.75rem;
    padding: 0.5rem;
    margin: 0 1rem 2rem 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

#floating-search.scrolled input {
    background: rgba(31, 41, 55, 0.95);
    border-color: rgba(75, 85, 99, 0.8);
}

/* Search input focus effects */
#searchInput:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Smooth transitions for all search elements */
#floating-search * {
    transition: all 0.2s ease;
}

/* Document Section Styles */
.doc-section {
    scroll-margin-top: 4rem;
}

/* Utility Classes */
.antialiased {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Responsive Design for Documentation */
@media (max-width: 768px) {
    .code-block {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .copy-btn {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }
}
