/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #dcddde;
    background: #1a1a2e;
    min-height: 100vh;
}

html {
    scroll-behavior: smooth;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== HEADER ===== */
.header {
    background: #16213e;
    border-bottom: 2px solid #5865f2;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 2rem;
    color: #5865f2;
}

.logo h1 {
    font-size: 1.3rem;
    color: #fff;
    font-weight: 700;
}

/* logo image replacement for discord icon */
.logo-img {
    width: 2rem;
    height: auto;
    display: block;
}

/* smaller logo inside buttons */
.btn-logo {
    width: 1.2rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.status-badges {
    display: flex;
    gap: 0.5rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.loading {
    background: #4a4a5a;
    color: #999;
}

.badge.ok {
    background: #234d2c;
    color: #57f287;
}

.badge.fail {
    background: #4d2323;
    color: #ed4245;
}

/* ===== MAIN ===== */
.main {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ===== STEP SECTIONS ===== */
.step-section {
    background: #16213e;
    border-radius: 12px;
    border: 1px solid #2a2a4a;
    overflow: hidden;
    transition: opacity 0.3s, filter 0.3s;
}

.step-section.disabled {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(50%);
}

.step-section.active {
    border-color: #5865f2;
    box-shadow: 0 0 20px rgba(88, 101, 242, 0.15);
}

.step-section.completed {
    border-color: #57f287;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: #1a1a3e;
    border-bottom: 1px solid #2a2a4a;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #5865f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.step-section.completed .step-number {
    background: #57f287;
    color: #1a1a2e;
}

.step-header h2 {
    color: #fff;
    font-size: 1.1rem;
    line-height: 1.3;
}

.step-header p {
    color: #8e9297;
    font-size: 0.85rem;
}

.step-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ===== INSTRUCTIONS CARD ===== */
.instructions-card {
    background: #1a1a3e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1.25rem;
}

.instructions-card h3 {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.instructions-card ol {
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.instructions-card li {
    color: #b9bbbe;
    font-size: 0.9rem;
}

.instructions-card li strong {
    color: #fff;
}

.hint {
    color: #72767d;
    font-size: 0.8rem;
    font-style: italic;
}

/* ===== INPUTS ===== */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #b9bbbe;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-row {
    display: flex;
    gap: 0.5rem;
}

/* ===== PRESET LIBRARY ===== */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.preset-btn {
    background: #1a1a3e;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 0.9rem;
}

.preset-btn:hover {
    border-color: #5865f2;
    background: rgba(88,101,242,0.08);
}

.preset-btn.selected {
    border-color: #5865f2;
    background: rgba(88,101,242,0.15);
    box-shadow: 0 0 12px rgba(88,101,242,0.2);
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid #2a2a4a;
    background: #0f0f23;
    color: #dcddde;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #5865f2;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    cursor: pointer;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: #5865f2;
    color: #fff;
}

.btn-primary:hover {
    background: #4752c4;
}

.btn-primary:disabled {
    background: #4a4a5a;
    color: #72767d;
    cursor: not-allowed;
}

.btn-discord {
    background: #5865f2;
    color: #fff;
    padding: 0.8rem 1.6rem;
    font-size: 1rem;
}

.btn-discord:hover {
    background: #4752c4;
}

.btn-success {
    background: #57f287;
    color: #1a1a2e;
}

.btn-success:hover {
    background: #45d172;
}

.btn-large {
    padding: 0.9rem 2rem;
    font-size: 1rem;
}

.action-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== FEEDBACK ===== */
.feedback {
    font-size: 0.85rem;
    padding: 0;
    border-radius: 6px;
    min-height: 0;
    transition: all 0.3s;
}

.feedback.show {
    padding: 0.75rem 1rem;
    min-height: 40px;
}

.feedback.success {
    background: #1a3d2a;
    color: #57f287;
    border: 1px solid #2d5a3d;
}

.feedback.error {
    background: #3d1a1a;
    color: #ed4245;
    border: 1px solid #5a2d2d;
}

.feedback.info {
    background: #1a2a3d;
    color: #5865f2;
    border: 1px solid #2d3d5a;
}

/* ===== PREVIEW ===== */
.preview-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-visual {
    background: #0f0f23;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1.25rem;
}

.preview-server-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
}

.preview-server-desc {
    font-size: 0.85rem;
    color: #8e9297;
    margin-bottom: 1rem;
}

.preview-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #72767d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 1rem 0 0.5rem 0;
}

.preview-role {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0.15rem;
    border: 1px solid;
}

.preview-category {
    margin-bottom: 0.75rem;
}

.preview-category-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #8e9297;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.3rem 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.preview-channel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem 0.35rem 1.5rem;
    color: #8e9297;
    font-size: 0.9rem;
    border-radius: 4px;
}

.preview-channel:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #dcddde;
}

.preview-channel i {
}

.preview-message {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    color: #b9bbbe;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.preview-message strong {
    color: #dcddde;
}

.preview-channel i {
    width: 20px;
    text-align: center;
    font-size: 0.85rem;
}

/* Restricted channel badge */
.preview-channel.restricted {
    position: relative;
}

.preview-channel .restricted-badge {
    /* place the badge near the channel name (not pushed to the far right) */
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(88,101,242,0.08);
    color: #a5b4fc;
    border: 1px solid rgba(88,101,242,0.16);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.preview-channel .restricted-roles {
    margin-left: 0.5rem;
    color: #b9bbbe;
    font-size: 0.75rem;
}

/* small inline lock icon next to channel name */
.lock-inline {
    margin-right: 0.45rem;
    color: #a5b4fc;
    font-size: 0.78rem;
}
.json-details {
    background: #0f0f23;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    overflow: hidden;
}

.json-details summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: #8e9297;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.json-details summary:hover {
    color: #dcddde;
}

.json-details pre {
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.8rem;
    color: #57f287;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
    border-top: 1px solid #2a2a4a;
}

/* ===== EXECUTION LOG ===== */
.log-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    background: #0f0f23;
    font-size: 0.85rem;
    border: 1px solid #2a2a4a;
}

.log-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.log-entry.success .log-icon {
    color: #57f287;
}

.log-entry.error .log-icon {
    color: #ed4245;
}

.log-entry.running .log-icon {
    color: #fee75c;
}

.log-message {
    flex: 1;
    color: #b9bbbe;
    word-break: break-word;
}

.log-message strong {
    color: #fff;
}

.log-time {
    color: #4a4a5a;
    font-size: 0.7rem;
    flex-shrink: 0;
    font-family: monospace;
}

.log-details {
    margin-top: 0.4rem;
    padding: 0.5rem;
    background: #1a1a2e;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    color: #ed4245;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ===== RESULT BANNER ===== */
.result-banner {
    padding: 1.25rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    margin-top: 1rem;
}

.result-banner.success {
    background: #1a3d2a;
    color: #57f287;
    border: 2px solid #57f287;
}

.result-banner.error {
    background: #3d1a1a;
    color: #ed4245;
    border: 2px solid #ed4245;
}

/* ===== OVERLAY ===== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.spinner-box {
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #2a2a4a;
    border-top-color: #5865f2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-box p {
    color: #b9bbbe;
    font-size: 0.95rem;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 2rem;
    color: #4a4a5a;
    font-size: 0.8rem;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2a2a4a;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3a5a;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .input-row {
        flex-direction: column;
    }

    .btn-large {
        width: 100%;
    }

    .main {
        padding: 0 0.75rem;
    }
}
/* ===== AUTH ===== */
.auth-card {
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid #2a2a4a;
}

.auth-tab {
    flex: 1;
    padding: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #72767d;
    background: #1a1a3e;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-tab:hover {
    color: #dcddde;
    background: #1e1e44;
}

.auth-tab.active {
    color: #fff;
    background: #16213e;
    border-bottom: 2px solid #5865f2;
}

.auth-form {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-form h2 {
    color: #fff;
    font-size: 1.4rem;
    margin-bottom: 0;
}

.auth-subtitle {
    color: #8e9297;
    font-size: 0.875rem;
    margin-top: -0.75rem;
}

.input-password-row {
    position: relative;
    display: flex;
    align-items: center;
}

.input-password-row input {
    padding-right: 2.75rem;
}

.btn-eye {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: #72767d;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.btn-eye:hover {
    color: #dcddde;
}

.btn-full {
    width: 100%;
}

/* ===== USER INFO / SIGN OUT IN HEADER ===== */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid #2a2a4a;
}

.user-email {
    font-size: 0.78rem;
    color: #8e9297;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-signout {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #2a1a1a;
    color: #ed4245;
    border: 1px solid #4d2323;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-signout:hover {
    background: #3d1a1a;
    border-color: #ed4245;
}

@media (max-width: 640px) {
    .user-email { display: none; }
    .user-info { margin-left: 0; }
}

/* ===== CREDITS BADGE ===== */
.credits-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    background: #1a2d1a;
    border: 1px solid #2d5a2d;
    color: #fee75c;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.credits-badge i {
    font-size: 0.7rem;
}

/* ===== ADMIN PANEL ===== */
.admin-section {
    border-color: #fee75c55;
}

.admin-section .step-header {
    background: #1e1c10;
}

.admin-users-wrap {
    background: #0f0f23;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    overflow: hidden;
}

.admin-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #1a1a3e;
    border-bottom: 1px solid #2a2a4a;
    font-size: 0.85rem;
    font-weight: 600;
    color: #b9bbbe;
}

.admin-users-list {
    max-height: 260px;
    overflow-y: auto;
}

.admin-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #1a1a3a;
    cursor: pointer;
    transition: background 0.15s;
}

.admin-user-row:hover {
    background: rgba(88, 101, 242, 0.08);
}

.admin-user-row:last-child {
    border-bottom: none;
}

.admin-user-email {
    font-size: 0.875rem;
    color: #dcddde;
}

.admin-user-credits {
    font-size: 0.825rem;
    font-weight: 700;
    color: #fee75c;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.admin-empty {
    padding: 1.25rem;
    color: #72767d;
    font-size: 0.875rem;
    text-align: center;
}

.admin-credit-form {
    background: #1a1a3e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-credit-form h3 {
    color: #fff;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-amount-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.btn-danger {
    background: #ed4245;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-danger:hover {
    background: #c73537;
}

@media (max-width: 640px) {
    .admin-amount-row { flex-direction: column; }
    .credits-badge { display: none; }
}

/* ===== MODEL COST & GENERATE BUTTON COST BADGE ===== */
.btn-cost-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    margin-left: 0.5rem;
    background: rgba(255,255,255,0.15);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

select option:disabled {
    color: #4a4a5a;
}

/* Cost hint below model select */
.model-cost-hint {
    font-size: 0.8rem;
    color: #72767d;
    margin-top: 0.2rem;
}

/* ===== FEATURES DROPDOWN ===== */
.features-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    border: 1px solid #2a2a4a;
    background: #0f0f23;
    color: #b9bbbe;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: left;
}

.features-toggle:hover,
.features-toggle.active {
    border-color: #57f287;
    background: rgba(87, 242, 135, 0.04);
    color: #dcddde;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.features-toggle-chevron {
    color: #72767d;
    font-size: 0.78rem;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.features-panel {
    display: none;
    flex-direction: column;
    background: #1a1a3e;
    border: 1px solid #2a2a4a;
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.features-panel.open {
    display: flex;
}

/* Legend */
.features-tier-legend {
    display: flex;
    gap: 1.5rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #2a2a4a;
    font-size: 0.78rem;
    color: #8e9297;
    background: #16163a;
}

.tier-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Real HTML table */
.features-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.features-table th,
.features-table td {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid #22223a;
    vertical-align: middle;
}

.features-table tbody tr:last-child td {
    border-bottom: none;
}

.features-table thead th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #72767d;
    background: #16163a;
    border-bottom: 1px solid #2a2a4a;
    text-align: center;
}

.features-table thead th:first-child,
.features-table thead th:nth-child(2) {
    text-align: left;
}

.features-table tbody tr:hover {
    background: rgba(88, 101, 242, 0.05);
}

/* Icon col */
.ft-icon {
    width: 32px;
    text-align: center;
    color: #72767d;
    font-size: 0.85rem;
}

/* Label col */
.ft-label {
    color: #b9bbbe;
}

/* Tier cols */
.ft-tier {
    text-align: center;
    width: 80px;
    font-size: 1.1rem;
    line-height: 1;
}

.ft-tier .fa-check-circle {
    color: #57f287;
    filter: drop-shadow(0 0 5px rgba(87, 242, 135, 0.5));
}

.ft-tier .fa-adjust {
    color: #f5a623;
    filter: drop-shadow(0 0 5px rgba(245, 166, 35, 0.5));
}
