/* static/css/modern_common_style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Light Theme Variables - Professional & Clean */
    --bg-primary-light: #f4f6f8;
    /* Very light gray, almost white */
    --bg-secondary-light: #ffffff;
    /* Card background, pure white for contrast */
    --bg-tertiary-light: #e9ecef;
    /* Input fields, subtle dividers */
    --text-primary-light: #212529;
    /* Dark gray for primary text */
    --text-secondary-light: #495057;
    /* Medium gray for secondary text */
    --text-muted-light: #6c757d;
    /* Lighter gray for less important text */
    --accent-primary-light: #007bff;
    /* Classic blue for primary actions */
    --accent-secondary-light: #0056b3;
    /* Darker blue for hover/active */
    --border-color-light: #dee2e6;
    /* Standard border color */
    --card-shadow-light: 0 2px 4px rgba(0, 0, 0, 0.05), 0 5px 15px rgba(0, 0, 0, 0.05);
    /* Softer, layered shadow */
    --success-light: #28a745;
    --error-light: #dc3545;
    --warning-light: #ffc107;
    --info-light: #17a2b8;
    --disabled-bg-light: #f1f3f5;
    --disabled-text-light: #adb5bd;

    /* Dark Theme Variables - Modern, Deep & Accessible */
    --bg-primary-dark: #0d1117;
    /* GitHub-like deep dark blue/gray */
    --bg-secondary-dark: #161b22;
    /* Card background, slightly lighter */
    --bg-tertiary-dark: #21262d;
    /* Input fields, borders in dark mode */
    --text-primary-dark: #c9d1d9;
    /* Light gray/off-white for primary text */
    --text-secondary-dark: #8b949e;
    /* Medium gray for secondary text */
    --text-muted-dark: #586069;
    /* Darker gray for muted text */
    --accent-primary-dark: #58a6ff;
    /* Brighter blue for dark mode actions */
    --accent-secondary-dark: #1f6feb;
    /* Slightly different hover for dark blue */
    --border-color-dark: #30363d;
    /* Border color that matches tertiary bg or slightly darker */
    --card-shadow-dark: 0 2px 8px rgba(0, 0, 0, 0.2), 0 5px 20px rgba(0, 0, 0, 0.15);
    /* Subtle shadow for dark */
    --success-dark: #3fb950;
    --error-dark: #f85149;
    --warning-dark: #d29922;
    --info-dark: #388bfd;
    --disabled-bg-dark: #21262d;
    --disabled-text-dark: #484f58;

    /* Common Variables */
    --card-border-radius: 10px;
    --button-border-radius: 6px;
    --input-border-radius: 6px;
    --transition-fast: 0.15s ease-in-out;
    --transition-smooth: 0.25s ease-in-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary-light);
    /* Applied to body */
    color: var(--text-primary-light);
    /* Applied to body */
    line-height: 1.6;
    padding: 20px;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.no-scroll {
    overflow: hidden;
}

/* Dark mode styles applied when html has data-theme="dark" */
html[data-theme="dark"] {
    background-color: var(--bg-primary-dark);
    /* Ensure html background is dark too */
    color: var(--text-primary-dark);
}

html[data-theme="dark"] body {
    /* Make body inherit from html in dark mode */
    background-color: inherit;
    color: inherit;
}

/* Apply dark theme variables to specific elements when data-theme="dark" is on HTML */
html[data-theme="dark"] header h1 {
    color: var(--text-primary-dark);
}

html[data-theme="dark"] header p.subtitle {
    color: var(--text-secondary-dark);
}

html[data-theme="dark"] .card {
    background-color: var(--bg-secondary-dark);
    border-color: var(--border-color-dark);
    box-shadow: var(--card-shadow-dark);
}

html[data-theme="dark"] .card.glass {
    /* Dark Glassmorphism if used */
    background: rgba(30, 30, 30, 0.75);
    /* Slightly more opaque */
    border: 1px solid var(--border-color-dark);
    box-shadow: var(--card-shadow-dark);
    /* Can be same or adjusted */
}

html[data-theme="dark"] .card h2 {
    color: var(--text-primary-dark);
}

html[data-theme="dark"] label {
    color: var(--text-secondary-dark);
}

html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="datetime-local"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] select {
    background-color: var(--bg-tertiary-dark);
    color: var(--text-primary-dark);
    border-color: var(--border-color-dark);
}

html[data-theme="dark"] input[type="text"]::placeholder,
html[data-theme="dark"] input[type="password"]::placeholder {
    color: var(--text-muted-dark);
}

html[data-theme="dark"] input[type="text"]:focus,
html[data-theme="dark"] input[type="password"]:focus,
html[data-theme="dark"] input[type="datetime-local"]:focus,
html[data-theme="dark"] input[type="number"]:focus,
html[data-theme="dark"] input[type="email"]:focus,
html[data-theme="dark"] select:focus {
    border-color: var(--accent-primary-dark);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25);
    /* Adjusted focus ring for dark */
    background-color: var(--bg-secondary-dark);
    /* Can keep it same or slightly different */
}

/* Fix for datetime-local icon color in dark mode */
html[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}


html[data-theme="dark"] button {
    background-color: var(--accent-primary-dark);
    color: var(--bg-primary-dark);
    /* High contrast text on button */
}

html[data-theme="dark"] button:hover {
    background-color: var(--accent-secondary-dark);
}

html[data-theme="dark"] button:disabled {
    background-color: var(--disabled-bg-dark);
    color: var(--disabled-text-dark);
}

html[data-theme="dark"] .button-secondary {
    background-color: transparent;
    /* More subtle secondary button */
    color: var(--accent-primary-dark);
    border: 1px solid var(--accent-primary-dark);
}

html[data-theme="dark"] .button-secondary:hover {
    background-color: rgba(88, 166, 255, 0.1);
    /* Slight background on hover */
    color: var(--accent-primary-dark);
    /* Keep text color */
}

html[data-theme="dark"] .button-danger {
    background-color: var(--error-dark);
    color: var(--bg-primary-dark);
}

html[data-theme="dark"] .button-danger:hover {
    background-color: #d9363e;
}

/* Darken from --error-dark */

html[data-theme="dark"] .message.success {
    background-color: rgba(63, 185, 80, 0.15);
    color: var(--success-dark);
    border-color: rgba(63, 185, 80, 0.3);
}

html[data-theme="dark"] .message.error {
    background-color: rgba(248, 81, 73, 0.15);
    color: var(--error-dark);
    border-color: rgba(248, 81, 73, 0.3);
}

html[data-theme="dark"] .message.info {
    background-color: rgba(56, 139, 253, 0.15);
    color: var(--info-dark);
    border-color: rgba(56, 139, 253, 0.3);
}

html[data-theme="dark"] .message.warning {
    background-color: rgba(210, 153, 34, 0.15);
    color: var(--warning-dark);
    border-color: rgba(210, 153, 34, 0.3);
}

html[data-theme="dark"] .theme-switch-button {
    background-color: var(--bg-tertiary-dark);
}

html[data-theme="dark"] .theme-switch-button:hover {
    background-color: var(--border-color-dark);
}

html[data-theme="dark"] .input-group input:focus+button {
    border-left-color: var(--accent-primary-dark);
}

/* Adjust for dark */
html[data-theme="dark"] #qrCodeImage {
    border-color: var(--border-color-dark);
}

html[data-theme="dark"] table {
    border-color: var(--border-color-dark);
}

html[data-theme="dark"] th,
html[data-theme="dark"] td {
    border-bottom-color: var(--border-color-dark);
}

html[data-theme="dark"] th {
    background-color: var(--bg-tertiary-dark);
    color: var(--text-primary-dark);
}

html[data-theme="dark"] .status-active {
    color: var(--success-dark);
}

html[data-theme="dark"] .status-disabled {
    color: var(--disabled-text-dark);
}

html[data-theme="dark"] .status-expired {
    color: var(--error-dark);
}

    html[data-theme="dark"] .loader {
        border-color: var(--bg-tertiary-dark);
        border-top-color: var(--accent-primary-dark);
    }

    html[data-theme="dark"] .input-group input {
        border-right-color: var(--border-color-dark);
    }

/* Key Status Styling */
.key-status.valid {
    color: var(--success-light);
    font-weight: 600;
}

html[data-theme="dark"] .key-status.valid {
    color: var(--success-dark);
}

.key-status.expired,
.key-status.invalid {
    color: var(--error-light);
    font-weight: 600;
}

html[data-theme="dark"] .key-status.expired,
html[data-theme="dark"] .key-status.invalid {
    color: var(--error-dark);
}

.key-status.unknown {
    color: var(--text-muted-light);
    font-style: italic;
}

html[data-theme="dark"] .key-status.unknown {
    color: var(--text-muted-dark);
}

/* Countdown Tag Styling */
.countdown-tag {
    display: inline-block;
    padding: 3px 8px;
    margin-left: 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: rgba(0, 123, 255, 0.1); /* Light blue background */
    color: var(--accent-primary-light);
    border: 1px solid rgba(0, 123, 255, 0.3);
    white-space: nowrap;
}

html[data-theme="dark"] .countdown-tag {
    background-color: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary-dark);
    border-color: rgba(88, 166, 255, 0.3);
}

/* Key Note Styling */
.key-note-style {
    display: inline-block;
    padding: 5px 10px;
    background-color: var(--bg-tertiary-light);
    border-radius: var(--input-border-radius);
    font-style: italic;
    color: var(--text-secondary-light);
    word-break: break-word; /* Ensure long notes wrap */
    max-width: 100%; /* Ensure it doesn't overflow */
}

html[data-theme="dark"] .key-note-style {
    background-color: var(--bg-tertiary-dark);
    color: var(--text-secondary-dark);
}

/* Key Info Item Styling */
.key-info-item {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    margin-bottom: 5px; /* Space between items */
    background-color: var(--bg-tertiary-light);
    border-radius: var(--input-border-radius);
    border: 1px solid var(--border-color-light);
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

html[data-theme="dark"] .key-info-item {
    background-color: var(--bg-tertiary-dark);
    border-color: var(--border-color-dark);
}

.key-info-item:last-child {
    margin-bottom: 0;
}

.key-info-label {
    font-weight: 500;
    color: var(--text-secondary-light);
    margin-right: 10px;
    white-space: nowrap; /* Prevent label from wrapping */
}

html[data-theme="dark"] .key-info-label {
    color: var(--text-secondary-dark);
}

/* Adjust key-note-style to fit within key-info-item */
.key-note-style {
    flex-grow: 1; /* Allow it to take remaining space */
    padding: 0; /* Remove padding as it's now on the parent */
    background-color: transparent; /* Remove background as it's on the parent */
    border-radius: 0; /* Remove border-radius */
    font-style: italic;
    color: var(--text-primary-light); /* Use primary text color for content */
    word-break: break-word;
    max-width: none; /* Remove max-width constraint */
}

html[data-theme="dark"] .key-note-style {
    background-color: transparent;
    color: var(--text-primary-dark);
}

/* Specific style for the note item to apply the background/border to the whole row */
.key-note-item-note {
    background-color: var(--bg-tertiary-light);
    border: 1px solid var(--border-color-light);
    border-radius: var(--input-border-radius);
    padding: 8px 15px; /* Match other key-info-item padding */
}

html[data-theme="dark"] .key-note-item-note {
    background-color: var(--bg-tertiary-dark);
    border-color: var(--border-color-dark);
}

/* Styles for copyable key cells */
.copyable-key {
    font-family: monospace;
    color: var(--accent-primary-light); /* Make it look like a link */
    text-decoration: underline;
    cursor: pointer;
    word-break: break-all; /* Ensure long keys wrap */
}

html[data-theme="dark"] .copyable-key {
    color: var(--accent-primary-dark);
}

.copyable-key:hover {
    opacity: 0.8;
}

.copyable-key-header {
    /* Optional: style for the header of the copyable key column */
    /* For example, to add a subtle icon or different text style */
}


.container {
    width: 100%;
    max-width: 1800px;
    margin: auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 20px;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary-light);
    margin-bottom: 8px;
}

header p.subtitle {
    font-size: 1rem;
    color: var(--text-muted-light);
}

.card {
    background-color: var(--bg-secondary-light);
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow-light);
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color-light);
    transition: background-color var(--transition-smooth), border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary-light);
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary-light);
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
input[type="number"],
input[type="email"],
select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color-light);
    border-radius: var(--input-border-radius);
    background-color: var(--bg-tertiary-light);
    color: var(--text-primary-light);
    font-size: 0.95rem;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary-light);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
    background-color: var(--bg-secondary-light);
}

button {
    padding: 10px 18px;
    background-color: var(--accent-primary-light);
    color: white;
    border: none;
    border-radius: var(--button-border-radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

button:hover {
    background-color: var(--accent-secondary-light);
    box-shadow: 0 1px 3px rgba(0, 122, 255, 0.15);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0px);
    box-shadow: none;
}

button:disabled {
    background-color: var(--disabled-bg-light);
    color: var(--disabled-text-light);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.button-secondary {
    background-color: var(--bg-secondary-light);
    color: var(--accent-primary-light);
    border: 1px solid var(--border-color-light);
    /* Lighter border for secondary */
}

.button-secondary:hover {
    background-color: var(--bg-tertiary-light);
    color: var(--accent-secondary-light);
    border-color: var(--accent-primary-light);
    /* Highlight border on hover */
}

.button-danger {
    background-color: var(--error-light);
}

.button-danger:hover {
    background-color: #c82333;
}

.message {
    padding: 10px 15px;
    margin-top: 15px;
    margin-bottom: 15px;
    border-radius: var(--input-border-radius);
    font-size: 0.875rem;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message.success {
    background-color: #e6f7ec;
    color: #0f5132;
    border-color: #badbcc;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.message.info {
    background-color: #cce5ff;
    color: #004085;
    border-color: #b8daff;
}

.message.warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}

.theme-switch-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-secondary-light);
    border: 1px solid var(--border-color-light);
    box-shadow: var(--card-shadow-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    /* Emoji size */
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    z-index: 1000;
    user-select: none;
    /* Prevent text selection on emoji */
    -webkit-tap-highlight-color: transparent;
}

.theme-switch-button:hover {
    background-color: var(--bg-tertiary-light);
    transform: scale(1.1);
}

.theme-switch-button .emoji-sun {
    display: block;
}

/* Default sun for light mode */
.theme-switch-button .emoji-moon {
    display: none;
}

html[data-theme="dark"] .theme-switch-button .emoji-sun {
    display: none;
}

html[data-theme="dark"] .theme-switch-button .emoji-moon {
    display: block;
}


.input-group {
    display: flex;
    margin-bottom: 15px;
}

.input-group input {
    flex-grow: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 0;
    border-right: none;
}

.input-group button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    width:150px;
}

.input-group input:focus+button {
    border-left-color: var(--accent-primary-light);
    z-index: 1;
}

#qrCodeImage {
    max-width: 100%;
    width: 280px;
    /* Slightly adjusted default size */
    height: auto;
    border: 1px solid var(--border-color-light);
    border-radius: var(--input-border-radius);
    margin: 15px auto;
    display: block;
}

#qrCodeContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}

#keysTable {
    min-height: 300px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    font-size: 0.875rem;
    border: 1px solid var(--border-color-light);
    border-radius: var(--input-border-radius);
    overflow: hidden;
}

th,
td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color-light);
}

th {
    background-color: var(--bg-tertiary-light);
    font-weight: 600;
    color: var(--text-primary-light);
}

tr:last-child td {
    border-bottom: none;
}

td .actions button {
    margin-right: 10px; /* 增加间距 */
    padding: 5px 8px;
    font-size: 0.8rem;
}

td .actions button:last-child {
    margin-right: 0;
}

.status-active {
    color: var(--success-light);
    font-weight: 500;
}

.status-disabled {
    color: var(--disabled-text-light);
    font-style: italic;
}

.status-expired {
    color: var(--error-light);
    font-weight: 500;
}

.loader {
    width: 28px;
    height: 28px;
    border: 3px solid var(--bg-tertiary-light);
    border-top-color: var(--accent-primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.expiry-preset-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.expiry-preset-row label {
    margin-bottom: 0;
    white-space: nowrap;
}

.expiry-preset-row select {
    flex-grow: 1;
    margin-bottom: 0;
}

.expiry-preset-row input[type="datetime-local"] {
    flex-grow: 1.5;
    margin-bottom: 0;
}

/* QR Actions Buttons Styling */
#qrActions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

#qrActions button {
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* Fullscreen Modal Styles */
#fullscreenQrModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    /* Darker overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 15px;
    cursor: zoom-out;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

#fullscreenQrImage {
    max-width: 95vw;
    max-height: 95vh;
    /* Use viewport units for better fit */
    object-fit: contain;
    border-radius: var(--input-border-radius);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.15);
}

#closeFullscreenModalButton {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    line-height: 34px;
    text-align: center;
    padding: 0;
    cursor: pointer;
}

#closeFullscreenModalButton:hover {
    background: rgba(255, 255, 255, 0.2);
}


/* Responsive Button Group */
.button-group-responsive {
    display: flex;
    gap: 10px;
}

.button-group-responsive button {
    flex-grow: 1; /* Make buttons share space equally */
}

@media (max-width: 768px) {
    .button-group-responsive {
        flex-direction: column;
    }

    body {
        padding: 10px;
    }

    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    header p.subtitle {
        font-size: 0.9rem;
    }

    .card {
        padding: 15px;
    }

    .key-info-item {
        flex-wrap: wrap;
        row-gap: 5px;
    }

    .countdown-tag {
        flex-basis: 100%;
        text-align: center;
        margin-left: 0;
    }

    input[type="text"],
    input[type="password"],
    input[type="datetime-local"],
    input[type="number"],
    select,
    button {
        font-size: 0.9rem;
        padding: 10px;
    }

    #qrCodeImage {
        width: 90%;
        max-width: 240px;
    }

    .theme-switch-button {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }

    table {
        display: block;
        overflow-x: auto;
    }

    th,
    td {
        white-space: nowrap;
    }

    .expiry-preset-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .expiry-preset-row label {
        margin-bottom: 4px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.6rem;
    }

    .input-group {
        flex-direction: column;
    }

    .input-group input,
    .input-group button {
        border-radius: var(--input-border-radius);
        border-right: 1px solid var(--border-color-light);
        margin-bottom: 8px;
    }

    html[data-theme="dark"] .input-group input {
        border-right-color: var(--border-color-dark);
    }

    .input-group button {
        margin-left: 0;
        width: 100%;
    }

    td .actions button {
        margin-bottom: 5px;
        display: block;
        width: 100%;
    }

    #qrActions {
        flex-direction: column;
        gap: 8px;
    }

    #qrActions button {
        width: 100%;
    }
}

.mt-1 {
    margin-top: .25rem
}

.mt-2 {
    margin-top: .5rem
}

.mt-3 {
    margin-top: 1rem
}

.mb-1 {
    margin-bottom: .25rem
}

.mb-2 {
    margin-bottom: .5rem
}

.mb-3 {
    margin-bottom: 1rem
}

.text-center {
    text-align: center
}

.d-none {
    display: none !important
}

.d-block {
    display: block !important
}

.w-100 {
    width: 100%
}

/* Pagination Controls Styling */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping */
    gap: 15px;
    padding: 15px 0;
    border-top: 1px solid var(--border-color-light);
    margin-top: 20px;
}

html[data-theme="dark"] .pagination-controls {
    border-top-color: var(--border-color-dark);
}

.pagination-controls button {
    padding: 8px 15px;
    font-size: 0.9rem;
    min-width: 80px;
}

.pagination-controls .page-info {
    font-size: 0.95rem;
    color: var(--text-secondary-light);
    white-space: nowrap;
}

.pagination-go-to {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination-go-to .page-input {
    width: 60px; /* Adjust width as needed */
    padding: 6px 8px;
    margin-bottom: 0; /* Override default margin-bottom */
    text-align: center;
    font-size: 0.9rem;
}

.pagination-go-to button {
    padding: 6px 10px;
    font-size: 0.9rem;
}

html[data-theme="dark"] .pagination-controls .page-info {
    color: var(--text-secondary-dark);
}

/* Adjust button styles for pagination if needed, ensuring consistency */
.pagination-controls button:disabled {
    background-color: var(--disabled-bg-light);
    color: var(--disabled-text-light);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.7;
}

    html[data-theme="dark"] .pagination-controls button:disabled {
        background-color: var(--disabled-bg-dark);
        color: var(--disabled-text-dark);
    }

/* Quick Fill Tags Styling */
.quick-fill-tags-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color-light);
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative; /* For fade effect */
}

html[data-theme="dark"] .quick-fill-tags-container {
    border-top-color: var(--border-color-dark);
}

.tag-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.tag-section-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary-light);
    margin-right: 5px;
    white-space: nowrap;
}

html[data-theme="dark"] .tag-section-title {
    color: var(--text-secondary-dark);
}

.tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-button {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: var(--button-border-radius);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    user-select: none;
    white-space: nowrap;
}

/* Category Tags - Blue/Accent */
.category-tags .tag-button {
    background-color: rgba(0, 123, 255, 0.1); /* Light blue background */
    color: var(--accent-primary-light);
    border-color: rgba(0, 123, 255, 0.3);
}

.category-tags .tag-button:hover {
    background-color: rgba(0, 123, 255, 0.2);
    border-color: var(--accent-primary-light);
}

html[data-theme="dark"] .category-tags .tag-button {
    background-color: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary-dark);
    border-color: rgba(88, 166, 255, 0.3);
}

html[data-theme="dark"] .category-tags .tag-button:hover {
    background-color: rgba(88, 166, 255, 0.2);
    border-color: var(--accent-primary-dark);
}

/* Quantity Tags - Green/Success */
.quantity-tags .tag-button {
    background-color: rgba(40, 167, 69, 0.1); /* Light green background */
    color: var(--success-light);
    border-color: rgba(40, 167, 69, 0.3);
}

.quantity-tags .tag-button:hover {
    background-color: rgba(40, 167, 69, 0.2);
    border-color: var(--success-light);
}

html[data-theme="dark"] .quantity-tags .tag-button {
    background-color: rgba(63, 185, 80, 0.1);
    color: var(--success-dark);
    border-color: rgba(63, 185, 80, 0.3);
}

html[data-theme="dark"] .quantity-tags .tag-button:hover {
    background-color: rgba(63, 185, 80, 0.2);
    border-color: var(--success-dark);
}

/* Filter Tags - Orange/Warning */
.filter-tags .tag-button {
    background-color: rgba(255, 193, 7, 0.1); /* Light orange background */
    color: var(--warning-light);
    border-color: rgba(255, 193, 7, 0.3);
}

.filter-tags .tag-button:hover {
    background-color: rgba(255, 193, 7, 0.2);
    border-color: var(--warning-light);
}

html[data-theme="dark"] .filter-tags .tag-button {
    background-color: rgba(210, 153, 34, 0.1);
    color: var(--warning-dark);
    border-color: rgba(210, 153, 34, 0.3);
}

html[data-theme="dark"] .filter-tags .tag-button:hover {
    background-color: rgba(210, 153, 34, 0.2);
    border-color: var(--warning-dark);
}


/* QR Instruction Card Styling */
.qr-instruction-card {
    width: 100%;
    border-radius: var(--card-border-radius);
    box-sizing: border-box;
    padding: 15px 20px;
    background-color: var(--bg-secondary-light);
    box-shadow: var(--card-shadow-light);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px; /* Space below the instruction card */
    border: 1px solid var(--border-color-light);
}

html[data-theme="dark"] .qr-instruction-card {
    background-color: var(--bg-secondary-dark);
    box-shadow: var(--card-shadow-dark);
    border-color: var(--border-color-dark);
}

.qr-instruction-icon-container {
    width: 40px;
    height: 40px;
    min-width: 40px; /* Prevent shrinking */
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(40, 167, 69, 0.1); /* Light green background */
    border-radius: 50%;
}

html[data-theme="dark"] .qr-instruction-icon-container {
    background-color: rgba(63, 185, 80, 0.1);
}

.qr-instruction-icon {
    width: 20px;
    height: 20px;
    color: var(--success-light);
}

html[data-theme="dark"] .qr-instruction-icon {
    color: var(--success-dark);
}

.qr-instruction-text-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    flex-grow: 1;
}

.qr-instruction-text,
.qr-instruction-sub-text {
    margin: 0;
    cursor: default;
    line-height: 1.4;
}

.qr-instruction-text {
    color: var(--text-primary-light);
    font-size: 1rem;
    font-weight: 600;
}

html[data-theme="dark"] .qr-instruction-text {
    color: var(--text-primary-dark);
}

.qr-instruction-sub-text {
    font-size: 0.85rem;
    color: var(--text-muted-light);
    margin-top: 3px;
}

html[data-theme="dark"] .qr-instruction-sub-text {
    color: var(--text-muted-dark);
}

/* Timeline Styles */
.timeline-container {
    position: relative;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    margin-left: 20px; /* Use margin to position the whole container */
}

.timeline-container.visible {
    opacity: 1;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 19px; /* (40px icon width / 2) - (2px line width / 2) = 19px */
    top: 10px;
    bottom: 10px;
    width: 2px;
    background-color: var(--border-color-light);
    border-radius: 2px;
    transform-origin: top;
    animation: grow-line 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
    transform: scaleY(0);
    z-index: 0;
}

html[data-theme="dark"] .timeline-container::before {
    background-color: var(--border-color-dark);
}

.timeline-item {
    position: relative;
    display: flex;
    align-items: flex-start; /* Align items to the top */
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
    animation-delay: var(--delay, 0s);
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-icon {
    position: relative; /* Changed from absolute */
    width: 40px; /* Increased size */
    height: 40px; /* Increased size */
    min-width: 40px; /* Prevent shrinking */
    border-radius: 50%;
    background-color: var(--bg-secondary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none; /* Removed border */
    z-index: 1;
    margin-right: 15px; /* Space between icon and content */
}

html[data-theme="dark"] .timeline-icon {
    background-color: var(--bg-secondary-dark);
    border: none; /* Removed border for dark theme */
}

.timeline-icon svg {
    width: 32px; /* Increased size */
    height: 32px; /* Increased size */
    color: var(--success-light);
}

html[data-theme="dark"] .timeline-icon svg {
    color: var(--success-dark);
}

.timeline-icon .checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--success-light);
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

html[data-theme="dark"] .timeline-icon .checkmark__circle {
    stroke: var(--success-dark);
}

.timeline-icon .checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-width: 3;
    stroke: var(--success-light);
    fill: none;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

html[data-theme="dark"] .timeline-icon .checkmark__check {
    stroke: var(--success-dark);
}

/* Warning Icon Styles */
.timeline-icon .warning-icon__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--accent-primary-light); /* Blue color */
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

html[data-theme="dark"] .timeline-icon .warning-icon__circle {
    stroke: var(--accent-primary-dark);
}

.timeline-icon .warning-icon__line {
    stroke-dasharray: 28;
    stroke-dashoffset: 28;
    stroke-width: 3;
    stroke: var(--accent-primary-light); /* Blue color */
    fill: none;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

html[data-theme="dark"] .timeline-icon .warning-icon__line {
    stroke: var(--accent-primary-dark);
}

.timeline-icon .warning-icon__dot {
    fill: var(--accent-primary-light); /* Blue color */
    opacity: 0;
    animation: fadeIn 0.2s ease-in 0.9s forwards;
}

html[data-theme="dark"] .timeline-icon .warning-icon__dot {
    fill: var(--accent-primary-dark);
}


@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

.timeline-content {
    flex-grow: 1; /* Allow content to take remaining space */
    padding: 8px 15px; /* Adjusted padding */
    background-color: var(--bg-tertiary-light);
    border-radius: var(--input-border-radius);
    border: 1px solid var(--border-color-light);
}

html[data-theme="dark"] .timeline-content {
    background-color: var(--bg-tertiary-dark);
    border-color: var(--border-color-dark);
}

.timeline-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary-light);
}

html[data-theme="dark"] .timeline-content p {
    color: var(--text-secondary-dark);
}

.timeline-content img {
    max-width: 100%;
    border-radius: var(--input-border-radius);
    margin-top: 10px;
    border: 1px solid var(--border-color-light);
    display: block; /* Ensure it's a block element for margin auto to work if needed */
    transition: max-height 0.5s ease-in-out, opacity 0.5s ease-in-out;
    max-height: 500px; /* Default max-height */
    overflow: hidden;
}

.timeline-content img.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    border: none;
}

.fullscreen-button {
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: var(--button-border-radius);
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 8px;
    display: inline-block;
    transition: background-color var(--transition-fast);
}

.fullscreen-button:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

html[data-theme="dark"] .timeline-content img {
    border-color: var(--border-color-dark);
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes grow-line {
    to {
        transform: scaleY(1);
    }
}

/* Mobile Responsiveness and Fade Effect */
@media (max-width: 768px) {
    /* Removed mobile-specific hiding, fade, and load more button styles for quick-fill tags */
    /* The quick-fill-tags-container will now display fully by default on mobile */
    /* The loadMoreTagsButton will remain hidden as per its d-none class in HTML */
}

/* Loader SVG for timeline */
.timeline-icon .loader-container {
  width: 32px; /* Match SVG size */
  height: 32px; /* Match SVG size */
  transform-origin: center;
  animation: rotate4 2s linear infinite;
}

.timeline-icon .loader-path {
  fill: none;
  stroke: var(--accent-primary-light);
  stroke-width: 4; /* Adjusted stroke-width for visibility */
  stroke-dasharray: 2, 200;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  animation: dash4 1.5s ease-in-out infinite;
}

html[data-theme="dark"] .timeline-icon .loader-path {
    stroke: var(--accent-primary-dark);
}

/* --- New Styles for Qinglong ID Selector Modal --- */
.qinglong-id-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 60vh; /* Limit height and allow scrolling */
    overflow-y: auto;
    padding-right: 5px; /* Space for scrollbar */
}

.qinglong-id-item {
    background-color: var(--bg-secondary-light);
    border: 1px solid var(--border-color-light);
    border-radius: var(--input-border-radius);
    margin-bottom: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.3s ease-out forwards;
}

.qinglong-id-item:last-child {
    margin-bottom: 0;
}

.qinglong-id-item:hover {
    border-color: var(--accent-primary-light);
    transform: translateY(-2px) scale(1.01);
    box-shadow: var(--card-shadow-light);
}

.id-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color-light);
}

.action-name {
    font-weight: 600;
    color: var(--accent-primary-light);
    font-size: 1.05rem;
}

.timestamp {
    font-size: 0.8rem;
    color: var(--text-muted-light);
}

.id-item-body .detail-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.detail-label {
    font-weight: 500;
    color: var(--text-secondary-light);
    margin-right: 8px;
    white-space: nowrap;
}

.detail-value {
    font-family: monospace;
    background-color: var(--bg-tertiary-light);
    padding: 2px 6px;
    border-radius: 4px;
}

.filter-details-box {
    margin-top: 8px;
}

/* JSON Viewer Styles */
.json-viewer {
    background-color: var(--bg-tertiary-light);
    border: 1px solid var(--border-color-light);
    border-radius: var(--input-border-radius);
    padding: 12px;
    font-size: 0.85rem;
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
}

.json-pair {
    display: flex;
    margin-bottom: 6px;
}

.json-pair:last-child {
    margin-bottom: 0;
}

.json-key {
    font-weight: 600;
    color: var(--text-secondary-light);
    margin-right: 8px;
    white-space: nowrap;
}

.json-value {
    color: var(--text-primary-light);
    word-break: break-all;
}

/* Dark Theme for Qinglong ID Selector */
html[data-theme="dark"] .qinglong-id-item {
    background-color: var(--bg-secondary-dark);
    border-color: var(--border-color-dark);
}

html[data-theme="dark"] .qinglong-id-item:hover {
    border-color: var(--accent-primary-dark);
    box-shadow: var(--card-shadow-dark);
}

html[data-theme="dark"] .id-item-header {
    border-bottom-color: var(--border-color-dark);
}

html[data-theme="dark"] .action-name {
    color: var(--accent-primary-dark);
}

html[data-theme="dark"] .timestamp {
    color: var(--text-muted-dark);
}

html[data-theme="dark"] .detail-label {
    color: var(--text-secondary-dark);
}

html[data-theme="dark"] .detail-value {
    background-color: var(--bg-primary-dark); /* Darker than the item bg */
}

html[data-theme="dark"] .json-viewer {
    background-color: var(--bg-primary-dark);
    border-color: var(--border-color-dark);
}

html[data-theme="dark"] .json-key {
    color: var(--text-secondary-dark);
}

html[data-theme="dark"] .json-value {
    color: var(--text-primary-dark);
}


@keyframes rotate4 {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes dash4 {
  0% {
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
  }

  50% {
    stroke-dasharray: 90, 200;
    stroke-dashoffset: -35px;
  }

  100% {
    stroke-dashoffset: -125px;
  }
}

/* --- New Styles for Notification Settings --- */

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--card-border-radius);
    transition: opacity 0.2s ease-in-out;
}

html[data-theme="dark"] .loading-overlay {
    background-color: rgba(22, 27, 34, 0.7); /* --bg-secondary-dark with opacity */
}

/* Generic Spinner Style */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-tertiary-light);
    border-top-color: var(--accent-primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

html[data-theme="dark"] .spinner {
    border-color: var(--bg-tertiary-dark);
    border-top-color: var(--accent-primary-dark);
}

/* Switch Toggle Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 50px; /* Adjusted width */
    height: 28px; /* Adjusted height */
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary-light);
    transition: var(--transition-smooth);
    border-radius: 28px; /* Fully rounded */
    border: 1px solid var(--border-color-light);
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px; /* Adjusted size */
    width: 20px; /* Adjusted size */
    left: 3px; /* Adjusted position */
    bottom: 3px; /* Adjusted position */
    background-color: white;
    transition: var(--transition-smooth);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

input:checked + .slider {
    background-color: var(--success-light);
    border-color: var(--success-light);
}

input:checked + .slider:before {
    transform: translateX(22px); /* Adjusted translation */
}

/* Dark theme for switch */
html[data-theme="dark"] .slider {
    background-color: var(--bg-tertiary-dark);
    border-color: var(--border-color-dark);
}

html[data-theme="dark"] .slider:before {
    background-color: var(--text-secondary-dark);
}

html[data-theme="dark"] input:checked + .slider {
    background-color: var(--success-dark);
    border-color: var(--success-dark);
}

html[data-theme="dark"] input:checked + .slider:before {
    background-color: var(--bg-secondary-dark);
}

/* --- Styles for Step 2: Configuration Module --- */

#configModule h2 {
    border-bottom: 1px solid var(--border-color-light);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

html[data-theme="dark"] #configModule h2 {
    border-bottom-color: var(--border-color-dark);
}

.config-sub-card {
    background-color: var(--bg-tertiary-light);
    border: 1px solid var(--border-color-light);
    border-radius: var(--input-border-radius);
    padding: 20px;
    margin-bottom: 20px;
    transition: all var(--transition-smooth);
}

html[data-theme="dark"] .config-sub-card {
    background-color: var(--bg-tertiary-dark);
    border-color: var(--border-color-dark);
}

.config-sub-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary-light);
}

html[data-theme="dark"] .config-sub-card h3 {
    color: var(--text-primary-dark);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-item {
    display: flex;
    flex-direction: column;
}

.form-item label {
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary-light);
}

html[data-theme="dark"] .form-item label {
    color: var(--text-secondary-dark);
}

/* Custom Date Input Styles */
.date-range-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-range-wrapper input[type="date"] {
    background-color: var(--bg-secondary-light);
    border: 1px solid var(--border-color-light);
    padding: 8px 10px;
    border-radius: var(--input-border-radius);
    font-family: inherit;
    color: var(--text-primary-light);
    flex-grow: 1;
    margin-bottom: 0; /* Override default */
}

html[data-theme="dark"] .date-range-wrapper input[type="date"] {
    background-color: var(--bg-secondary-dark);
    border-color: var(--border-color-dark);
    color: var(--text-primary-dark);
}

html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
}

.date-range-wrapper span {
    color: var(--text-muted-light);
}

html[data-theme="dark"] .date-range-wrapper span {
    color: var(--text-muted-dark);
}

/* Custom Select Styles */
.form-item select {
    margin-bottom: 0; /* Override default */
}

/* Keyword Input Styles */
.keyword-input-wrapper {
    margin-top: 8px;
}

.keyword-input-wrapper input {
    margin-bottom: 0;
}

/* Checkbox Styles */
.form-item label.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
}

.form-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary-light);
}

html[data-theme="dark"] .form-item input[type="checkbox"] {
    accent-color: var(--accent-primary-dark);
}

.form-item-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}

.button-group {
    margin-top: 25px;
    border-top: 1px solid var(--border-color-light);
    padding-top: 20px;
}

html[data-theme="dark"] .button-group {
    border-top-color: var(--border-color-dark);
}

/* Info hint card for config options */
.form-item-hint {
    padding: 10px;
    margin-top: 8px;
    border-radius: var(--input-border-radius);
    font-size: 0.8rem;
    background-color: rgba(23, 162, 184, 0.1);
    color: var(--info-light);
    border: 1px solid rgba(23, 162, 184, 0.2);
}

html[data-theme="dark"] .form-item-hint {
    background-color: rgba(56, 139, 253, 0.1);
    color: var(--info-dark);
    border-color: rgba(56, 139, 253, 0.2);
}

@media (max-width: 480px) {
    .date-range-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .date-range-wrapper span {
        display: none; /* Hide the "to" text on mobile */
    }

    .pagination-controls {
        gap: 10px; /* Reduce gap on mobile */
    }

    /* Force a line break after the page info span */
    .pagination-controls .page-info {
        flex-basis: 100%;
        text-align: center;
        order: -1; /* Move page info to the top */
        margin-bottom: 10px;
    }
}

/* --- Dropdown Menu Styles --- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown .dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--bg-secondary-light);
    min-width: 220px; /* Increased width for longer text */
    box-shadow: var(--card-shadow-light);
    border-radius: var(--input-border-radius);
    border: 1px solid var(--border-color-light);
    z-index: 9999;
    overflow: hidden;
    padding: 5px 0;
}

.dropdown .dropdown-content.show {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

.dropdown .dropdown-content a {
    color: var(--text-primary-light);
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-size: 0.875rem;
    transition: background-color var(--transition-fast);
}

.dropdown .dropdown-content a:hover {
    background-color: var(--bg-tertiary-light);
}

/* Dark Theme for Dropdown */
html[data-theme="dark"] .dropdown .dropdown-content {
    background-color: var(--bg-secondary-dark);
    box-shadow: var(--card-shadow-dark);
    border-color: var(--border-color-dark);
}

html[data-theme="dark"] .dropdown .dropdown-content a {
    color: var(--text-primary-dark);
}

html[data-theme="dark"] .dropdown .dropdown-content a:hover {
    background-color: var(--bg-tertiary-dark);
}

/* Ensure actions cell buttons have consistent spacing */
td.actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* --- Modern Log View Styles --- */
#logContent {
    background-color: #0d1117 !important; /* Fixed dark background */
    color: #c9d1d9 !important; /* Light text color */
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
    font-size: 0.85rem;
    padding: 15px; /* Restore padding */
    border: 1px solid #30363d !important;
    line-height: 1.5; /* Adjust line height for readability */
    white-space: pre-wrap; /* Ensure wrapping */
    word-break: break-word; /* Ensure long words break */
}

/* Override spinner color for the dark log view, regardless of theme */
#logContent .spinner {
    border-color: #21262d;
    border-top-color: #58a6ff;
}

/* Card Header for Toggle Button */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px; /* Same as h2 margin-bottom */
}

.card-header h2 {
    margin-bottom: 0; /* Remove margin from h2 inside header */
}

.toggle-button {
    background: none;
    border: 1px solid var(--border-color-light); /* 在明亮模式下添加边框 */
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), transform var(--transition-smooth), border-color var(--transition-fast);
}

.toggle-button:hover {
    background-color: var(--bg-tertiary-light);
    transform: none; /* Override default button hover transform */
}

html[data-theme="dark"] .toggle-button {
    border-color: var(--border-color-dark); /* 在暗黑模式下添加边框 */
}

html[data-theme="dark"] .toggle-button:hover {
    background-color: var(--bg-tertiary-dark);
}

.toggle-button svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary-light);
    transition: transform var(--transition-smooth);
}

html[data-theme="dark"] .toggle-button svg {
    color: var(--text-primary-dark); /* 在暗黑模式下使用更亮的颜色 */
}

/* Collapsed State */
#configModule.config-collapsed .icon-chevron-up {
    transform: rotate(180deg);
}

#configContent {
    max-height: 2000px; /* Large enough for content */
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.25, 0.1, 0.25, 1), 
                opacity 0.3s ease-in-out 0.1s,
                margin-top 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
    opacity: 1;
    margin-top: 0;
}

#configModule.config-collapsed #configContent {
    max-height: 0;
    opacity: 0;
    margin-top: -20px; /* Pull up the bottom border */
    transition: max-height 0.4s cubic-bezier(0.65, 0, 0.35, 1), 
                opacity 0.2s ease-in-out,
                margin-top 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

/* Styles for the new collapsible feature */
#configModule.config-collapsed .config-options-container,
#configModule.config-collapsed .config-footer {
    display: none;
}

/* --- Header Action Buttons --- */
.header-actions-container {
    position: fixed; /* 改为 fixed 以便随页面滑动而固定 */
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary-light);
    border: 1px solid var(--border-color-light);
    border-radius: 30px; /* Make it an oval shape */
    padding: 5px;
    box-shadow: var(--card-shadow-light);
    transition: all var(--transition-smooth);
    z-index: 1000; /* 确保菜单在最上层 */
}

html[data-theme="dark"] .header-actions-container {
    background-color: var(--bg-primary-dark); /* 改为更深的背景，以突出按钮 */
    border-color: var(--border-color-dark);
    box-shadow: var(--card-shadow-dark);
}

.action-btn {
    background-color: transparent;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    padding: 0; /* Reset padding */
}

.action-btn:hover {
    background-color: var(--bg-tertiary-light);
    transform: none; /* Override default button hover */
    box-shadow: none; /* Override default button hover */
}

/* 为暗黑模式下的 action-btn 添加默认背景色 */
html[data-theme="dark"] .action-btn {
    background-color: #161B22; /* 用户要求的颜色 */
}

html[data-theme="dark"] .action-btn:hover {
    background-color: #21262d; /* 比 #161B22 更浅的颜色 */
}

.action-btn svg {
    width: 22px;
    height: 22px;
    fill: var(--text-secondary-light);
    transition: fill var(--transition-fast);
}

html[data-theme="dark"] .action-btn svg {
    fill: var(--text-secondary-dark);
}

.action-btn:hover svg {
    fill: var(--text-primary-light);
}

html[data-theme="dark"] .action-btn:hover svg {
    fill: var(--text-primary-dark);
}

/* Specific SVG path fills if needed */
/* -- More Options Button -- */
.action-btn#moreOptionsButton svg path[p-id="6058"] { /* Darker dots */
    fill: var(--text-secondary-light);
}
.action-btn#moreOptionsButton svg path[p-id="6059"] { /* Lighter dots */
    fill: var(--text-muted-light);
}

html[data-theme="dark"] .action-btn#moreOptionsButton svg path[p-id="6058"] {
    fill: var(--text-secondary-dark);
}
html[data-theme="dark"] .action-btn#moreOptionsButton svg path[p-id="6059"] {
    fill: var(--text-muted-dark);
}

/* -- Theme Switcher Button -- */
.action-btn#themeSwitcher svg path {
    fill: var(--text-secondary-light);
}
html[data-theme="dark"] .action-btn#themeSwitcher svg path {
    fill: var(--text-secondary-dark);
}

.action-btn#logoutButton svg path {
    fill: var(--text-secondary-light);
}
html[data-theme="dark"] .action-btn#logoutButton svg path {
    fill: var(--text-secondary-dark);
}

@media (max-width: 768px) {
    .header-actions-container {
        top: 10px;
        right: 10px;
    }
}

/* --- Dropdown Menu for Header Actions --- */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none; /* 默认隐藏 */
    position: absolute;
    right: 0;
    top: calc(100% + 5px); /* 定位在按钮下方 */
    background-color: var(--bg-secondary-light);
    min-width: 160px;
    box-shadow: var(--card-shadow-light);
    border-radius: var(--input-border-radius);
    border: 1px solid var(--border-color-light);
    z-index: 1001; /* 确保在 header-actions-container 之上 */
    overflow: hidden;
    padding: 5px 0;
    animation: fadeIn 0.15s ease-out;
}

.dropdown-menu.show {
    display: block; /* JS控制显示 */
}

.dropdown-menu a {
    color: var(--text-primary-light);
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-size: 0.875rem;
    transition: background-color var(--transition-fast);
}

.dropdown-menu a:hover {
    background-color: var(--bg-tertiary-light);
}

/* Dark Theme for Dropdown Menu */
html[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-secondary-dark);
    box-shadow: var(--card-shadow-dark);
    border-color: var(--border-color-dark);
}

html[data-theme="dark"] .dropdown-menu a {
    color: var(--text-primary-dark);
}

html[data-theme="dark"] .dropdown-menu a:hover {
    background-color: var(--bg-tertiary-dark);
}

/* --- Custom Scrollbar Styling --- */

/* For Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #007bff transparent; /* thumb color, track color */
}

/* For Webkit browsers (Chrome, Safari, iOS) */
/* This targets the scrollbar of the whole page and any scrollable div */
body::-webkit-scrollbar,
div::-webkit-scrollbar,
#logContent::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 8px;
    height: 8px;
}

body::-webkit-scrollbar-track,
div::-webkit-scrollbar-track,
#logContent::-webkit-scrollbar-track {
    background: transparent;
}

body::-webkit-scrollbar-thumb,
div::-webkit-scrollbar-thumb,
#logContent::-webkit-scrollbar-thumb {
    background-color: #007bff;
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

body::-webkit-scrollbar-thumb:hover,
div::-webkit-scrollbar-thumb:hover,
#logContent::-webkit-scrollbar-thumb:hover {
    background-color: #0056b3;
}
