:root {
    --bg-primary: #050505;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #111111;
    --bg-card: #0f0f0f;
    --accent-primary: #ffffff;
    /* Sober white accent */
    --accent-secondary: #e0e0e0;
    --accent-gradient: #333333;
    /* Flat dark accent instead of gradient */
    --text-primary: #eeeeee;
    --text-secondary: #888888;
    --text-muted: #555555;
    --border-color: #222222;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    --success: #4a9eff;
    --error: #e74c3c;
    --radius-round: 4px;
    /* More angular, modern */
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.settings-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-color);
    border-radius: var(--radius-round);
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
}

.back-link:hover {
    background: var(--text-muted);
}

.sidebar-nav {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    text-align: left;
    border-radius: var(--radius-round);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
}

.nav-item i {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
}

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

.nav-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.content-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 10px 40px 40px 40px;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.content-section h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    margin-top: 5px;
    color: var(--text-primary);
    font-weight: 700;
}

.subsection {
    margin-top: 40px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.02);
}

.subsection h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    margin-top: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.subsection h2 i {
    color: var(--accent-primary);
    opacity: 0.8;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.setting-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-round);
    padding: 20px;
    transition: all 0.2s ease;
    position: relative;
}

.setting-card:hover {
    border-color: var(--text-muted);
}

.setting-card.full-width {
    grid-column: 1 / -1;
}

.setting-card label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.setting-card input[type="text"],
.setting-card input[type="password"],
.setting-card input[type="number"],
.setting-card select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-round);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.setting-card input:focus,
.setting-card select:focus {
    outline: none;
    border-color: var(--text-muted);
    background: var(--bg-secondary);
}

.toggle-visibility {
    position: absolute;
    right: 32px;
    top: 62px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    transition: color 0.3s ease;
}

.toggle-visibility:hover {
    color: var(--text-primary);
}

.help-text {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: var(--text-secondary);
    transition: 0.2s;
    border-radius: 50%;
}

input:checked+.slider {
    background: var(--text-muted);
}

input:checked+.slider:before {
    transform: translateX(26px);
    background-color: white;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-round);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn-primary {
    background: var(--text-muted);
    color: white;
    border-color: transparent;
}

.btn-success {
    background: #1e2a3a;
    /* Dark muted blue */
    color: #4a9eff;
    border: 1px solid #4a9eff;
}

.btn:hover {
    background: var(--border-color);
    transform: none;
    box-shadow: none;
}

.btn-primary:hover {
    background: var(--text-secondary);
    color: white;
}

/* Save Section */
.save-section {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 24px 40px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.save-status {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.save-status.success {
    color: var(--success);
}

.save-status.error {
    color: var(--error);
}

/* Responsive */
@media (max-width: 768px) {
    .settings-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 20px;
    }

    .save-section {
        padding: 20px;
        margin: 20px -20px -20px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px 24px;
    border-radius: var(--radius-round);
    box-shadow: var(--shadow);
    color: var(--text-primary);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-notification.success {
    border-left: 4px solid var(--success);
}

.toast-notification.error {
    border-left: 4px solid var(--error);
}

.toast-notification i {
    font-size: 1.2em;
}

.toast-notification.success i {
    color: var(--success);
}

.toast-notification.error i {
    color: var(--error);
}

/* API Section Compact Styles */
#api-models .setting-card {
    padding: 12px;
}

#api-models h2 {
    font-size: 1rem;
    margin-bottom: 15px;
    margin-top: 25px;
}

#api-models label {
    font-size: 0.8rem;
    margin-bottom: 5px;
}

#api-models input,
#api-models select {
    font-size: 0.8rem;
    padding: 6px 10px;
    height: 32px;
}

#api-models .toggle-visibility {
    top: 50%;
    transform: translateY(-50%);
    right: 5px;
    padding: 4px;
    font-size: 0.8rem;
}

.api-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}

.btn-test {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: #2c3e50;
    border: 1px solid #34495e;
    color: #ecf0f1;
    border-radius: 3px;
    cursor: pointer;
    margin-right: 5px;
}

.btn-test:hover {
    background: #34495e;
}

/* User Management Specifics */
.credits-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.credits-display {
    font-weight: 600;
    color: #ffc107;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-icon.btn-danger:hover {
    background: rgba(244, 67, 54, 0.3);
    border-color: #f44336;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.status-badge.verified {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.status-badge.unverified {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.users-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.2s;
}

.users-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Modal Styles */
.user-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.user-modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.detail-item {
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.detail-item label {
    display: block;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.detail-item span {
    font-weight: 500;
    color: var(--text-primary);
}

/* Archives Grid */
.archives-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 30px;
}

.artwork-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    padding: 24px;
    margin-bottom: 20px;
}

.entry {
    display: flex;
    gap: 30px;
}

.image-column {
    flex: 0 0 300px;
}

.image-column img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.text-column {
    flex: 1;
}

.text-column h2 {
    margin: 10px 0;
    font-size: 1.4rem;
}

.text-column h3 {
    margin: 15px 0 5px;
    font-size: 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-line-break {
    white-space: pre-wrap;
    line-height: 1.5;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}