:root {
    --bg-color: #050505;
    --card-bg: #0a0a0a;
    --sidebar-bg: #0a0a0a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #fbb1ad;
    --accent-secondary: #ffd590;
    --accent-hover: #ff9595;
    --gradient-primary: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-secondary) 100%);
    --glass-bg: rgba(20, 20, 20, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glow-shadow: 0 0 100px rgba(251, 177, 173, 0.1);
    --success-color: #00e676;
    --error-color: #ff1744;
    --border-color: #333333;
    --input-bg: #1a1a1a;
    --transition: all 0.3s ease;
    --font-family: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Auth View */
#auth-view {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.auth-container .logo {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-box {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.tabs {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 1rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 1rem;
}

.auth-form.active {
    display: flex;
}

/* Dashboard Layout */
#dashboard-view {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar .logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .logo span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-logo {
    height: 1em;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    margin-bottom: 0.5rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links li:hover,
.nav-links li.active {
    background: rgba(251, 177, 173, 0.1);
    color: var(--accent-color);
}

.user-profile {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.user-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

#logout-btn {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: var(--error-color);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#logout-btn:hover {
    background: rgba(255, 77, 77, 0.2);
    border-color: var(--error-color);
    transform: translateY(-1px);
}

.content {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.3s ease;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero {
    margin-bottom: 3rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Forms & Inputs */
.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

input,
select,
textarea {
    width: 100%;
    padding: 1rem;
    padding-left: 2.5rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

textarea {
    padding-left: 1rem;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(251, 177, 173, 0.2);
}

.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

/* Ensure icon + label sit on one line inside primary buttons */
.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Shareable link layout */
.share-section {
    margin-top: 1rem;
}

.share-input-group {
    position: relative;
    display: flex;
    align-items: stretch;
}

.share-input-group .share-input {
    padding-left: 1rem;
    padding-right: 3rem;
}

.share-input-group .btn-copy-share {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    height: 2.25rem;
    padding: 0 0.75rem;
    border-radius: 6px;
    border: none;
    background: var(--gradient-primary);
    color: #000;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    white-space: nowrap;
    transition: var(--transition);
}

.share-input-group .btn-copy-share:hover {
    opacity: 0.9;
    transform: translateY(calc(-50% - 2px));
    box-shadow: 0 4px 12px rgba(251, 177, 173, 0.3);
}

.share-input-group .btn-copy-share i {
    font-size: 0.8rem;
}

.share-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    display: block;
}

.share-help {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-primary {
    background: var(--gradient-primary);
    color: #000;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 177, 173, 0.3);
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #222;
}

/* Modern Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--glow-shadow);
    margin-bottom: 3rem;
}

/* Segmented Control */
.segmented-control {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.segmented-control label {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    border-radius: 10px;
    color: var(--text-secondary);
    transition: var(--transition);
    font-weight: 500;
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control input[type="radio"]:checked+label {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Modern Input Area */
.modern-input-wrapper {
    position: relative;
    display: flex;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    transition: var(--transition);
}

.modern-input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(251, 177, 173, 0.2);
}

.modern-input-wrapper input {
    border: none;
    background: transparent;
    padding: 1rem;
    padding-left: 1rem;
    box-shadow: none;
}

.modern-input-wrapper .btn-primary {
    width: auto;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    margin-left: 0.5rem;
}

/* Feature Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Quality Select (Modern) */
.quality-wrapper {
    margin-bottom: 1.5rem;
}

.quality-wrapper select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

/* Download controls row (desktop/tablet) */
.download-controls-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Make the quality/format dropdown a fixed, compact width on large screens */
.download-controls-row .quality-wrapper {
    flex: 0 0 220px;
    margin-bottom: 0;
}

/* Explicit height + typography so it visually matches the URL control */
.download-controls-row .quality-wrapper select {
    height: 56px;
    padding: 0 1rem;
    font-size: 1rem;
    font-weight: 500;
}

/* Let the URL field + button take remaining width, and match height */
.download-controls-row .modern-input-wrapper {
    flex: 1;
    height: 56px;
    align-items: center;
}

.download-controls-row .modern-input-wrapper input {
    height: 100%;
}

.download-controls-row .modern-input-wrapper .btn-primary {
    height: 100%;
}

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    max-width: 1200px;
    margin: 0 auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-secondary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Wrap long text in Title/URL column and center text */
td:nth-child(2) {
    word-break: break-all;
    max-width: 300px;
    text-align: center;
}

/* Status & Progress */
.status-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    animation: fadeIn 0.3s ease;
}

.status-icon {
    font-size: 2rem;
    color: var(--accent-color);
}

.status-info {
    flex: 1;
}

.status-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.status-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--input-bg);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Result Card */
.result-card {
    background: linear-gradient(145deg, var(--card-bg), #1a1a1a);
    border: 1px solid var(--success-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    animation: slideUp 0.3s ease;
}

.result-icon {
    font-size: 2.5rem;
    color: var(--success-color);
}

.result-info {
    flex: 1;
}

.result-info h3 {
    color: var(--success-color);
    margin-bottom: 0.5rem;
}

.result-info p {
    margin-bottom: 1rem;
    font-weight: 500;
}

.result-actions {
    display: flex;
    gap: 1rem;
}

.result-actions .btn-primary,
.result-actions .btn-secondary {
    width: auto;
    padding: 0.75rem 1.5rem;
}

.result-preview {
    width: 100%;
    max-height: 360px;
    margin-bottom: 1rem;
    border-radius: 12px;
    background: #000;
    display: block;
}

/* Batch Section */
.batch-container {
    max-width: 800px;
    margin: 0 auto;
}

.textarea-wrapper {
    margin-bottom: 1.5rem;
}

.batch-options {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.batch-options select {
    width: auto;
    min-width: 150px;
}

.batch-options button {
    width: auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Settings Section */
.settings-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.settings-card h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.settings-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

#create-key-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

#create-key-form button {
    width: auto;
    white-space: nowrap;
}

/* Match dropdown-style text for key/profile buttons */
#profile-form .btn-primary,
#create-key-form .btn-primary {
    font-size: 1rem;
    font-weight: 500;
}

.api-key-item {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.key-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.key-info code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    color: var(--accent-color);
    font-size: 0.9rem;
    word-break: break-all;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--transition);
    font-size: 1.1rem;
}

.btn-icon:hover {
    color: var(--text-primary);
}

.btn-icon.delete:hover {
    color: var(--error-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.pagination button {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Vertically center the "Page X" text with the buttons */
.pagination span {
    display: flex;
    align-items: center;
    height: 36px;
}

/* Badge */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.completed {
    background: rgba(0, 230, 118, 0.15);
    color: var(--success-color);
}

.badge.processing {
    background: rgba(124, 77, 255, 0.15);
    color: var(--accent-color);
}

.badge.failed {
    background: rgba(255, 23, 68, 0.15);
    color: var(--error-color);
}

.badge.pending {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.badge.deleted {
    background: rgba(158, 158, 158, 0.15);
    color: #bdbdbd;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Toast */
#toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Batch Results */
.batch-results-list {
    margin-top: 2rem;
}

.batch-results-list h3 {
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.batch-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.batch-item-url {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 1rem;
}

.batch-item-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Header Row */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-row h1 {
    margin: 0;
}

/* Controls alignment - make type/quality/format/buttons same height and row */
.batch-options .option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.batch-options .toggle-switch {
    height: 40px;
    display: flex;
}

.batch-options .toggle-switch label {
    height: 100%;
    display: flex;
    align-items: center;
}

/* Override global padding for these selects so text is vertically centered */
.batch-options select {
    height: 40px;
    padding: 0 1rem;
}

/* Align button with bottom of selects in batch row */
.batch-options {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.batch-options .btn-primary {
    height: 40px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
}

/* Responsive */
@media (max-width: 768px) {
    #dashboard-view {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar .logo {
        margin-bottom: 1rem;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .nav-links li {
        margin-bottom: 0;
        white-space: nowrap;
    }

    .user-profile {
        position: absolute;
        top: 1rem;
        right: 1rem;
        border: none;
        padding: 0;
        margin: 0;
    }

    .user-info {
        display: none;
    }

    #logout-btn {
        width: auto;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .content {
        margin-left: 0;
        padding: 1rem;
    }

    .batch-options {
        flex-direction: column;
        align-items: stretch;
    }

    .batch-options button {
        width: 100%;
    }

    /* Stack download controls on mobile (keep original mobile layout) */
    .download-controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .download-controls-row .quality-wrapper {
        flex: 1 1 auto;
        margin-bottom: 1.25rem;
    }

    /* Make table responsive on mobile */
    .table-container {
        overflow-x: visible;
    }

    table {
        font-size: 0.85rem;
    }

    th,
    td {
        padding: 0.5rem;
        white-space: nowrap;
    }

    /* Hide less critical columns on mobile */
    th:nth-child(1),
    td:nth-child(1) {
        display: none;
        /* Hide Date column */
    }

    th:nth-child(3),
    td:nth-child(3) {
        display: none;
        /* Hide Type column */
    }
}

/* Modern Textarea */
.modern-textarea-wrapper {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    transition: var(--transition);
    overflow: hidden;
}

.modern-textarea-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(251, 177, 173, 0.2);
}

.modern-textarea-wrapper textarea {
    border: none;
    background: transparent;
    padding: 1rem;
    width: 100%;
    box-shadow: none;
    resize: vertical;
    min-height: 200px;
    display: block;
}

/* Batch Controls Layout */
.batch-controls-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    align-items: center;
}

/* Make dropdown and Queue All button always the same width */
.batch-controls-row>* {
    flex: 0 0 50%;
    max-width: 50%;
}

.batch-controls-row select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    height: 48px;
    /* Match button height */
}

.batch-controls-row .btn-primary {
    height: 48px;
    width: 100%;
    justify-content: center;
    /* Match dropdown text size/weight */
    font-size: 1rem;
    font-weight: 500;
}

/* Responsive Batch */
@media (max-width: 768px) {

    /* Keep the quality/format dropdown and Queue All button side by side on mobile */
    .batch-controls-row {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
    }

    /* Let the inner controls fill their 50% containers */
    .batch-controls-row select,
    .batch-controls-row .btn-primary {
        width: 100%;
    }

    table {
        table-layout: fixed !important;
    }

    th,
    td {
        vertical-align: top;
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
    }

    /* Hide Date and Type columns on mobile */
    th:nth-child(1),
    td:nth-child(1),
    th:nth-child(3),
    td:nth-child(3) {
        display: none !important;
    }

    /* Title/URL column */
    th:nth-child(2),
    td:nth-child(2) {
        width: 40% !important;
        max-width: 40% !important;
        overflow: hidden;
        white-space: normal;
    }

    /* Status column */
    th:nth-child(4),
    td:nth-child(4) {
        width: 40% !important;
    }

    /* Action column */
    th:nth-child(5),
    td:nth-child(5) {
        width: 20% !important;
        text-align: center;
    }
}

/* Card Header & Actions */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.card-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    width: auto;
}

/* Text Utilities */
.text-secondary {
    color: var(--text-secondary);
}

/* Table inside Glass Card */
.glass-card .table-container {
    background: transparent;
    border: none;
    border-radius: 0;
    margin: 0;
}

.glass-card .pagination {
    margin-top: 0;
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
}

/* Settings Form inside Glass Card */
.glass-card #create-key-form {
    margin-bottom: 2rem;
}

/* Settings Sections */
.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.settings-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Center "Feature Toggles" header + description (first settings-section in Admin) */
#admin-section .settings-section:first-of-type {
    text-align: center;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Password input with reveal toggle */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.password-toggle:hover {
    color: var(--text-primary);
}

/* Danger Zone */
.danger-zone {
    border: 1px solid rgba(255, 23, 68, 0.3);
    background: rgba(255, 23, 68, 0.03);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* Danger Zone text */
.danger-zone-text h3 {
    color: var(--error-color);
    margin: 0 0 0.5rem 0;
}

.danger-zone-text p {
    margin: 0;
}

/* Danger Zone button */
.danger-zone .btn-danger {
    width: auto;
    padding: 0.75rem 1.75rem;
}

.btn-danger {
    width: 100%;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 23, 68, 0.4);
    background: rgba(255, 23, 68, 0.1);
    color: var(--error-color);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background: rgba(255, 23, 68, 0.2);
    border-color: var(--error-color);
    transform: translateY(-1px);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
}

.modal {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.modal-header h2 {
    margin: 0 0 0.5rem;
}

.modal-body p {
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.modal-actions .btn-secondary,
.modal-actions .btn-danger {
    width: auto;
}