/* Apply new dark theme color palette */
html, body {
    background-color: #0D1117 !important;
    color: #C9D1D9 !important;
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
    line-height: 1; /* Normalize line-height globally */
}

.navbar {
    background-color: #161B22;
    padding: 0.75rem; /* Compact padding */
    border-bottom: 1px solid #30363D;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    color: #C9D1D9 !important;
    font-size: 1.25rem; /* Slightly smaller for compactness */
    text-decoration: none;
}

.navbar-brand:hover {
    color: #79C0FF !important; /* Softer blue for hover */
}

.nav-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.75rem; /* Compact gap */
}

.nav-links li {
    display: inline;
}

.nav-links a {
    color: #C9D1D9 !important;
    text-decoration: none;
    font-size: 0.95rem; /* Compact font size */
    padding: 0.3rem 0.5rem; /* Add padding for better click area */
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #79C0FF !important; /* Softer blue for hover */
}

.nav-links a.active {
    color: #79C0FF !important; /* Highlight active page */
    border-bottom: 2px solid #79C0FF; /* Underline active menu item */
}

main {
    padding: 1rem 0; /* More compact padding */
}

/* Login page specific styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px); /* Adjust for navbar height */
    padding: 1rem 0;
}

.login-box {
    background-color: #161B22; /* Boxed background */
    padding: 1.5rem; /* More spacious padding for login */
    border: 1px solid #30363D; /* Border for boxed look */
    border-radius: 6px;
    width: 100%;
    max-width: 400px; /* Fixed width for the login box */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); /* Subtle shadow for depth */
}

.login-form {
    display: flex;
    flex-direction: column; /* Stack items vertically */
    gap: 1rem; /* Increased gap for better spacing */
    margin-bottom: 0;
}

.login-form .form-item {
    display: flex;
    flex-direction: column;
}

.login-form input {
    padding: 0.5rem; /* Slightly larger padding for better usability */
    background-color: #1A1F27 !important; /* Slightly lighter background for inputs */
    color: #C9D1D9 !important;
    border: 1px solid #30363D !important;
    border-radius: 4px;
    font-size: 1rem; /* Slightly larger font size */
}

.login-form label {
    margin-bottom: 0.3rem; /* Slightly larger margin for clarity */
    font-size: 0.9rem; /* Slightly larger font size */
    color: #8B949E;
}

.login-form .btn {
    padding: 0.5rem 1rem; /* Larger padding for the button */
    font-size: 1rem; /* Slightly larger font size */
    background-color: #3E5480 !important; /* Brighter blue for the login button */
}

.login-form .btn:hover {
    background-color: #4A5E61 !important; /* Slightly lighter on hover */
}

.container {
    max-width: 1200px; /* Boxed layout */
    margin: 0 auto;
    padding: 0 1rem;
}

.welcome, .vmxss, .settings, .whitelist {
    background-color: #161B22; /* Boxed background */
    padding: 0.75rem; /* More compact padding */
    border: 1px solid #30363D; /* Border for boxed look */
    border-radius: 6px;
    margin-bottom: 1rem; /* More compact margin */
}

.whitelist-note {
    font-size: 0.9rem; /* Match other text sizes */
    color: #C9D1D9; /* Main text color */
    margin: 0.5rem 0; /* Consistent margin */
}

.summary-box {
    background-color: #1A1F27; /* Slightly lighter background */
    border: 1px solid #30363D;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 1rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.95rem;
    color: #C9D1D9;
}

.summary-box span {
    font-weight: bold;
    color: #79C0FF; /* Softer blue for emphasis */
}

.summary-box .btn {
    margin-left: 1rem;
}

.vmxss-actions {
    display: flex;
    gap: 0.5rem; /* Compact gap */
    margin-bottom: 0.75rem; /* Compact margin */
}

.search-form {
    display: flex;
    gap: 0.5rem; /* Compact gap */
    margin-bottom: 0.75rem; /* Compact margin */
}

.search-form input {
    flex-grow: 1;
}

.settings-form {
    display: flex;
    flex-direction: column; /* Stack items vertically */
    gap: 0.5rem; /* Compact gap */
    margin-bottom: 0.75rem; /* Compact margin */
}

.form-item {
    display: flex;
    flex-direction: column;
}

.form-button {
    align-self: center; /* Center the button */
}

.folder-list, .file-list, .whitelist-list {
    list-style: none;
    padding: 0;
}

.folder-list li, .file-list li, .whitelist-list li {
    margin: 0.15rem 0; /* More compact margin */
    padding: 0.02rem 0.1rem; /* Match file-table compactness */
    border-bottom: 1px solid #30363D; /* Border for separation */
    line-height: 1.2; /* More compact line height */
    font-size: 0.9rem; /* Compact font size */
}

/* Alternating backgrounds for folders, files, and whitelist lists */
.folder-list li:nth-child(odd), .file-list li:nth-child(odd), .whitelist-list li:nth-child(odd) {
    background-color: #1A1F27; /* Slightly lighter background for odd rows */
}

.folder-list li:nth-child(even), .file-list li:nth-child(even), .whitelist-list li:nth-child(even) {
    background-color: #14171D; /* Slightly darker background for even rows */
}

/* Layout for whitelist list items with remove button */
.whitelist-list li {
    display: flex;
    align-items: center;
}

.whitelist-list .remove-btn {
    margin-right: 0.3rem; /* Space between button and text */
}

/* Folder table styling */
.folder-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem; /* Compact margin */
    table-layout: fixed; /* Fix column widths */
}

.folder-table th,
.folder-table td {
    padding: 0.3rem; /* More compact padding */
    border: 1px solid #30363D; /* Border for cells */
    text-align: left;
    font-size: 0.9rem; /* Compact font size */
}

/* Define fixed column widths for folder-table */
.folder-table th:nth-child(1),
.folder-table td:nth-child(1) {
    width: 40%; /* Folder Name */
}

.folder-table th:nth-child(2),
.folder-table td:nth-child(2) {
    width: 15%; /* Videos */
}

.folder-table th:nth-child(3),
.folder-table td:nth-child(3) {
    width: 15%; /* Images */
}

.folder-table th:nth-child(4),
.folder-table td:nth-child(4) {
    width: 15%; /* Size */
}

.folder-table th:nth-child(5),
.folder-table td:nth-child(5) {
    width: 15%; /* Last Modified */
}

.folder-table th {
    background-color: #1A1F27; /* Slightly lighter background for header */
    color: #79C0FF; /* Softer blue for header text */
}

.folder-table tbody tr:nth-child(odd) {
    background-color: #1A1F27; /* Slightly lighter background for odd rows */
}

.folder-table tbody tr:nth-child(even) {
    background-color: #14171D; /* Slightly darker background for even rows */
}

.folder-table a {
    color: #79C0FF !important; /* Softer blue for folder links */
    text-decoration: none;
}

.folder-table a:hover {
    color: #D2E6FF !important; /* Light blue for hover */
}

/* File table styling */
.file-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem; /* Compact margin */
    table-layout: fixed; /* Fix column widths */
}

.file-table th,
.file-table td {
    padding: 0.02rem 0.1rem; /* Compact padding */
    border: 1px solid #30363D; /* Border for cells */
    text-align: left;
    font-size: 0.9rem; /* Compact font size */
    overflow: hidden; /* Prevent overflow */
    text-overflow: ellipsis; /* Ellipsis for long text */
    line-height: 1; /* Compact line height */
    vertical-align: middle; /* Center content vertically */
}

/* Remove default form spacing in table cells */
.file-table form {
    margin: 0;
    padding: 0;
    display: inline;
}

/* Define fixed column widths for file-table in vmxss.php and cinepop.php folder views (Folder Name, File Name, Action, File Size, Type) */
.file-table th:nth-child(1),
.file-table td:nth-child(1) {
    width: 25%; /* Folder Name (vmxss.php, cinepop.php) */
}

.file-table th:nth-child(2),
.file-table td:nth-child(2) {
    width: 43%; /* File Name (vmxss.php, cinepop.php) */
    word-break: break-all; /* Wrap long file names */
}

.file-table th:nth-child(3),
.file-table td:nth-child(3) {
    width: 14%; /* Action (vmxss.php, cinepop.php) */
}

.file-table th:nth-child(4),
.file-table td:nth-child(4) {
    width: 8%; /* File Size (vmxss.php, cinepop.php) */
}

.file-table th:nth-child(5),
.file-table td:nth-child(5) {
    width: 6%; /* Type (vmxss.php, cinepop.php) */
}

/* Override File Name font size for cinepop.php */
section.vmxss h2 + .vmxss-actions + .search-form + .file-table td:nth-child(2) {
    font-size: 0.85rem; /* Smaller font for File Name in cinepop.php folder view */
}

/* Define fixed column widths for file-table in bibamax.php root view (File Name, Action, File Size, Type, Last Modified) */
section.vmxss:not(:has(.vmxss-actions)) .file-table th:nth-child(1),
section.vmxss:not(:has(.vmxss-actions)) .file-table td:nth-child(1) {
    width: 55%; /* File Name (bibamax.php root) */
    word-break: break-all; /* Wrap long file names */
}

section.vmxss:not(:has(.vmxss-actions)) .file-table th:nth-child(2),
section.vmxss:not(:has(.vmxss-actions)) .file-table td:nth-child(2) {
    width: 14%; /* Action (bibamax.php root) */
}

section.vmxss:not(:has(.vmxss-actions)) .file-table th:nth-child(3),
section.vmxss:not(:has(.vmxss-actions)) .file-table td:nth-child(3) {
    width: 8%; /* File Size (bibamax.php root) */
}

section.vmxss:not(:has(.vmxss-actions)) .file-table th:nth-child(4),
section.vmxss:not(:has(.vmxss-actions)) .file-table td:nth-child(4) {
    width: 6%; /* Type (bibamax.php root) */
}

section.vmxss:not(:has(.vmxss-actions)) .file-table th:nth-child(5),
section.vmxss:not(:has(.vmxss-actions)) .file-table td:nth-child(5) {
    width: 15%; /* Last Modified (bibamax.php root) */
    white-space: nowrap; /* Prevent wrapping */
}

/* Define fixed column widths for file-table in settings.php whitelist tables (Action, Value) */
section.settings .file-table th:nth-child(1),
section.settings .file-table td:nth-child(1) {
    width: 6%; /* Adjusted to fit Remove button */
}

section.settings .file-table th:nth-child(2),
section.settings .file-table td:nth-child(2) {
    width: 94%; /* Adjusted to take remaining space */
}

.file-table th {
    background-color: #1A1F27; /* Slightly lighter background for header */
    color: #79C0FF; /* Softer blue for header text */
}

.file-table tbody tr:nth-child(odd) {
    background-color: #1A1F27; /* Slightly lighter background for odd rows */
}

.file-table tbody tr:nth-child(even) {
    background-color: #14171D; /* Slightly darker background for even rows */
}

.file-table .btn {
    margin-right: 0.02rem; /* Compact spacing between buttons */
    padding: 0.2rem 0.4rem; /* Reduced padding for tighter fit */
}

.file-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* More compact gap */
}

.folder-list a {
    color: #79C0FF !important; /* Softer blue for folder links */
    text-decoration: none;
}

.folder-list a:hover {
    color: #D2E6FF !important; /* Light blue for hover */
}

h1, h2, h3, h4 {
    color: #79C0FF !important; /* Softer blue for headings */
    margin: 0.5rem 0; /* More compact margins */
}

.btn {
    background-color: #2A3D66 !important; /* Muted blue for buttons */
    color: #DDE1E5 !important; /* Brighter off-white for better contrast */
    border: 1px solid #4A5E61 !important; /* Subtle border */
    padding: 0.3rem 0.6rem; /* More compact padding */
    border-radius: 4px; /* Slightly smaller radius */
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.85rem; /* Compact font size */
}

.btn:hover {
    background-color: #3E5480 !important; /* Lighter muted blue for hover */
}

.pagination {
    display: flex;
    justify-content: center; /* Center-align pagination */
    gap: 0.5rem; /* Compact gap */
    margin-top: 0.75rem; /* Compact margin */
    margin-bottom: 0.75rem; /* Consistent margin for top pagination */
}

.pagination .btn {
    padding: 0.3rem 0.6rem; /* Consistent compact padding */
}

.pagination .btn.active {
    background-color: #3E5480 !important; /* Highlight active page */
    font-weight: bold;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8) !important;
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    text-align: center; /* Center-align content */
}

.close {
    position: absolute;
    top: 0.75rem; /* Compact positioning */
    right: 0.75rem;
    color: #C9D1D9 !important;
    font-size: 1.5rem; /* Smaller for compactness */
    cursor: pointer;
}

.modal-buttons {
    margin-top: 0.5rem;
    text-align: center;
}

.close-btn {
    background-color: #2A3D66 !important;
    color: #DDE1E5 !important;
    border: 1px solid #4A5E61 !important;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.close-btn:hover {
    background-color: #3E5480 !important;
}

#video-player, #image-viewer {
    max-width: 100%;
    max-height: 80vh;
}

form {
    display: flex;
    gap: 0.5rem; /* Compact gap */
    margin-bottom: 1rem; /* More compact margin */
}

input, select, textarea {
    padding: 0.3rem; /* Compact padding */
    background-color: #161B22 !important;
    color: #C9D1D9 !important;
    border: 1px solid #30363D !important;
    border-radius: 4px;
    font-size: 0.85rem; /* Compact font size */
    width: 100%;
}

textarea {
    resize: vertical; /* Allow vertical resizing only */
}

label {
    display: block;
    margin-bottom: 0.2rem; /* Compact margin */
    font-size: 0.8rem; /* More compact font size */
    color: #8B949E;
}

/* Grid layout for forms with compact styling */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* More compact min width */
    gap: 0.5rem; /* More compact gap */
    margin-bottom: 1rem; /* More compact margin */
}

.grid-item {
    padding: 0.3rem; /* More compact padding */
    background-color: #1A1F27; /* Boxed background for form items */
    border: 1px solid #30363D; /* Border for boxed look */
    border-radius: 4px;
}

/* Error messages */
.error {
    color: #F85149;
    font-size: 0.85rem; /* More compact font size */
}

/* Success messages */
.success {
    color: #2ECC71; /* Green for success */
    font-size: 0.85rem; /* More compact font size */
}