/* general.css
 * Theme-independent, global styles only.
 * Loaded on every page via _MasterLayout.cshtml regardless of guild/theme.
 * Themes must remain fully self-contained; nothing here should become a
 * dependency of theme markup. All admin-bar related classes are prefixed
 * with "qw-admin-" to guarantee no collisions with theme CSS.
 */

/* ---- Minimal global utilities (theme-independent) ---- */
.display-block {
    display: block;
}

.display-none {
    display: none;
}

/* ---- Admin bar (fixed overlay, theme-independent) ---- */
.qw-admin-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2147483000; /* stay above arbitrary theme z-index values */
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 12px;
    background-color: #1f2937;
    color: #f9fafb;
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.qw-admin-bar-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qw-admin-bar a,
.qw-admin-bar button {
  
    background: transparent;
    /* border: 1px solid rgba(249, 250, 251, 0.35); color: #f9fafb; */
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.qw-admin-bar a:hover,
.qw-admin-bar button:hover {
    background-color: rgba(249, 250, 251, 0.15);
}

.qw-admin-bar-context {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qw-admin-bar-editmode-on {
    background-color: #b45309;
    border-color: #b45309;
}

/* ===== Admin bar (universal, outside themes) ===== */
.qw-admin-wrap { position: fixed; top: 0; right: 0; z-index: 9000; }

.qw-admin-bar {
    display: flex; align-items: center; gap: 12px;
    height: 40px; box-sizing: border-box;
    background: #1f2530; color: #fff; padding: 0 12px;
    font: 13px/1.4 sans-serif; box-shadow: 0 1px 6px rgba(0,0,0,.3);
    transform-origin: top right;
    transition: transform .25s ease, opacity .2s ease;
}
.qw-admin-bar-crumbs { margin-right: auto; }
.qw-admin-bar-links { display: inline-flex; align-items: center; gap: 8px; }
.qw-admin-bar a { color: #fff; text-decoration: none; }
.qw-admin-bar a:hover { text-decoration: underline; }
.qw-admin-bar-links a {
    border: 1px solid #fff; border-radius: 3px; padding: 2px 8px; line-height: 1;
}
.qw-admin-bar-editmode-on { color: #f5b06a !important; border-color: #f5b06a !important; font-weight: bold; }
.qw-admin-bar-crumbs .sep { color: #9aa7bd; margin: 0 2px; }
.qw-admin-collapse {
    cursor: pointer; background: none; border: 1px solid #faa; color: #faa;
    border-radius: 3px; font-size: 14px; padding: 2px 8px; line-height: 1;
}

/* Collapsed: hide the bar, show a 40x40 tab */
.qw-admin-tab {
    display: none; width: 40px; height: 40px; cursor: pointer;
    background: #1f2530; color: #fff; border: none; font-size: 18px;
    box-shadow: 0 1px 6px rgba(0,0,0,.3);
}
.qw-admin-wrap.collapsed .qw-admin-bar { transform: scale(0); opacity: 0; pointer-events: none; }
.qw-admin-wrap.collapsed .qw-admin-tab { display: block; }

/* ===== Edit-mode (draft) indicators ===== */
.qw-draft-frame {
    position: fixed; inset: 0; z-index: 8000;
    border: 4px dashed #e8811a;
    pointer-events: none;
}
.qw-draft-badge {
    position: fixed; left: 12px; bottom: 12px; z-index: 8001;
    background: #e8811a; color: #fff; font: bold 12px/1 sans-serif;
    padding: 8px 12px; border-radius: 4px; box-shadow: 0 1px 6px rgba(0,0,0,.3);
    pointer-events: none;
}

/* ===== Publish button + dialog ===== */
.qw-admin-publish { border: 1px solid #7CFC9A !important; color: #7CFC9A !important; font-weight: bold; }

.qw-publish-dialog {
    position: relative;
    border: none; border-radius: 6px; padding: 20px 22px; width: 380px; max-width: 90vw;
    box-shadow: 0 8px 30px rgba(0,0,0,.35); font: 14px/1.5 sans-serif;
}
.qw-publish-dialog::backdrop { background: rgba(0,0,0,.4); }
.qw-publish-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.qw-publish-dialog p { margin: 0 0 14px; color: #555; }
.qw-publish-dialog input[type=text] { width: 100%; padding: 6px 8px; box-sizing: border-box; margin-top: 4px; }
.qw-publish-x { position: absolute; top: 8px; right: 10px; background: none; border: none; font-size: 16px; cursor: pointer; color: #888; }
.qw-publish-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.qw-publish-go { background: #1f8a4c; color: #fff; border: none; border-radius: 4px; padding: 8px 16px; cursor: pointer; font-weight: bold; }
.qw-publish-actions button { padding: 8px 16px; cursor: pointer; }

/* ===== Success toast ===== */
.qw-toast {
    position: fixed; top: 52px; left: 50%; transform: translateX(-50%);
    z-index: 9500; background: #1f8a4c; color: #fff;
    font: bold 14px/1 sans-serif; padding: 12px 20px; border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
    opacity: 1; transition: opacity .4s ease, top .4s ease;
}
.qw-toast-hide { opacity: 0; top: 44px; }
.qw-toast-edit { background: #e8811a; }

/* ===== Admin UI styles ===== */
.qw-admin-input {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.qw-admin-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.qw-admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background-color: #2563eb;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.qw-admin-btn:hover {
    background-color: #1d4ed8;
}

.qw-admin-btn:active {
    transform: translateY(1px);
}

.qw-admin-btn-secondary {
    background-color: #6b7280;
}

.qw-admin-btn-secondary:hover {
    background-color: #4b5563;
}

.qw-admin-form-row {
    margin-bottom: 12px;
}

.qw-admin-form-row label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #374151;
    font-size: 13px;
}

.qw-admin-form-row input[type="text"] {
    width: 100%;
    max-width: 400px;
}

.qw-admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    background-color: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.qw-admin-table thead {
    background-color: #f9fafb;
}

.qw-admin-table th,
.qw-admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.qw-admin-table th {
    font-weight: 600;
    color: #374151;
    font-size: 13px;
}

.qw-admin-table tbody tr:hover {
    background-color: #f9fafb;
}

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

.qw-admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.qw-admin-badge-primary {
    background-color: #dbeafe;
    color: #1e40af;
}

.qw-admin-badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.qw-admin-badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ===== Editable sections (edit mode only) ===== */
body.qw_edit_mode section[data-section] {
    position: relative;
    outline: 1px dashed #e8811a;
    outline-offset: 2px;
    min-height: 32px;               /* empty sections stay clickable */
    transition: outline-width .1s ease;
}
body.qw_edit_mode section[data-section]:hover {
    outline: 3px dashed #e8811a;
    background: rgba(232,129,26,.05);
}
/* placeholder for empty editable sections */
body.qw_edit_mode section[data-section]:empty::before {
    content: "\270E Click Edit to add content";
    color: #b06a1a; font: italic 13px/1.6 sans-serif;
}
/* floating edit button (injected by JS) */
body.qw_edit_mode .qw-section-edit {
    position: absolute; top: 4px; right: 4px; z-index: 50;
    display: none;
    background: #e8811a; color: #fff; text-decoration: none;
    font: bold 12px/1 sans-serif; padding: 5px 9px; border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
body.qw_edit_mode section[data-section]:hover .qw-section-edit { display: inline-block; }

/* ===== Generic form/card utilities (theme-independent, structural) =====
 * These are reusable building blocks for any site/theme. They carry only neutral,
 * structural defaults. All look-and-feel that a theme may want to own is read from
 * --qw-* custom properties with sane fallbacks, so a theme can restyle by setting
 * those variables (or overriding the classes) in its css_code - without editing this file.
 */

.qw-card {
    background: var(--qw-card-bg, #ffffff);
    border: 1px solid var(--qw-card-border, #e5e7eb);
    border-radius: var(--qw-radius-lg, 14px);
    box-shadow: var(--qw-card-shadow, 0 6px 24px rgba(0, 0, 0, 0.08));
    padding: var(--qw-card-pad, 28px);
    box-sizing: border-box;
}

.qw-field { display: flex; flex-direction: column; }

.qw-label {
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--qw-label-color, #374151);
}

.qw-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    font-size: 15px;
    color: var(--qw-input-color, #111827);
    background: var(--qw-input-bg, #ffffff);
    border: 1px solid var(--qw-input-border, #d1d5db);
    border-radius: var(--qw-radius, 10px);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qw-input::placeholder { color: var(--qw-placeholder-color, #9ca3af); }

.qw-input:focus {
    outline: none;
    border-color: var(--qw-focus-color, #2563eb);
    box-shadow: 0 0 0 3px var(--qw-focus-ring, rgba(37, 99, 235, 0.15));
}

.qw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    color: var(--qw-btn-color, #ffffff);
    background: var(--qw-btn-bg, #2563eb);
    border: none;
    border-radius: var(--qw-radius, 10px);
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.05s ease;
}

.qw-btn:hover { background: var(--qw-btn-bg-hover, #1d4ed8); }
.qw-btn:active { transform: translateY(1px); }
.qw-btn-block { width: 100%; }

.qw-alert {
    padding: 11px 14px;
    border-radius: var(--qw-radius, 10px);
    font-size: 14px;
    margin-bottom: 14px;
}

.qw-alert-error {
    color: var(--qw-alert-error-color, #991b1b);
    background: var(--qw-alert-error-bg, #fef2f2);
    border: 1px solid var(--qw-alert-error-border, #fecaca);
}

.qw-alert-success {
    color: var(--qw-alert-success-color, #065f46);
    background: var(--qw-alert-success-bg, #ecfdf5);
    border: 1px solid var(--qw-alert-success-border, #a7f3d0);
}

/* ===== Password input (used by the <password-input> tag helper) =====
 * Bootstrap-agnostic: icons sit inside the input using absolute positioning,
 * so the input box, lock icon, and eye icon read as one seamless control
 * without relying on Bootstrap's input-group markup.
 */
.qw-input-wrap { position: relative; }

.qw-input-wrap .qw-input-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    pointer-events: none;
}

.qw-input-has-icon { padding-left: 40px; }
.qw-input-has-icon-end { padding-right: 40px; }

.qw-input-icon-end {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    /* Sit above the input so the icon actually receives mouse/touch events.
       Without this the input can capture pointer events over the icon and the
       press-and-hold reveal never fires. */
    z-index: 2;
}
/* The eye icon itself is the click target; make sure its inner sprite divs
   don't swallow the event target in a way that breaks closest() lookups. */
.qw-input-icon-end .icon20 { pointer-events: none; }

/* Password validity state coloring, applied to the lock icon / border. */
.pw-neutral { filter: none; }
.pw-red { filter: hue-rotate(-45deg) saturate(4); }
.pw-green { filter: hue-rotate(75deg) saturate(2.5); }


/* ===== Fixed "Edit Page" button (edit mode only) =====
 * Injected by _MasterLayout for SiteAdmins in edit mode. Mirrors the section-edit button look,
 * pinned to the lower-right of every content page. Uses its own class (qw-page-edit-fab) so it
 * never collides with the in-list "Edit" links on the /admin/pages screen (.qw-page-edit).
 */
.qw-page-edit-fab {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 8002; /* above the draft frame/badge */
    background: #e8811a;
    color: #fff;
    text-decoration: none;
    font: bold 13px/1 sans-serif;
    padding: 10px 14px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.qw-page-edit-fab:hover { background: #d4740f; }
