@import "./login.css";
@import "./musecore.css";
@import "./musenote.css";
@import "./musebite.css";
@import "./progression.css";
@import "./themes/dark.css";
@import "./themes/light.css";
@import "./toast.css";

/* SETUP */

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

*:focus {
    outline: none;
}

*::-webkit-scrollbar {
    height: 0.25rem;
    width: 0.25rem;
    opacity: 0.5;
}

:root {
    font-size: 16px;
    --font-family: "Sour Gummy", sans-serif;
}

@media (min-width: 1024px) { :root { font-size: 20px; } }
@media (min-width: 1440px) { :root { font-size: 24px; } }
@media (min-width: 1600px) { :root { font-size: 28px; } }

/* 2. BASE */

body {
    font-family: var(--font-family);
    font-size: 1rem;
    letter-spacing: 0.05em;
    background-color: var(--bg);
    color: var(--text);
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

h1 { font-size: 2rem; }

h3 { font-size: 1rem; }
p  { font-size: 0.75rem; }

a {
    color: var(--text);
    text-decoration: none;
}

button {
    font-family: var(--font-family);
    font-size: 1rem;
    letter-spacing: inherit;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.info-nav, .setting-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    aspect-ratio: 1 / 1;
    font-size: 0.75rem;
    border: 2px solid var(--text);
    border-radius: 50%;
    cursor: pointer;
}

.close-btn {
    position: absolute;
    right: 1.5rem;
    font-size: 1rem;
}

.close-btn:hover {
    text-shadow: 0 0 20px var(--text);
}

.overlay-section-btn {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    color: var(--text);
    border: 1px solid var(--text);
}

.aside-btn {
    font-size: 0.75rem;
    padding: 0.5rem 0;
}

.aside-btn.active, .aside-btn:hover {
    text-shadow: 0 0 20px var(--text);
}

.layout-footer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 0 auto;
    gap: 0.5rem;
    font-size: 0.75rem;
    opacity: 0.5;
}

.layout-footer-btn.active, .layout-footer-btn:hover {
    opacity: 1;
}

/* ============================================================
    Layout
============================================================ */

.screen-container {
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout {
    display: flex;
    flex-direction: column;
    height: 80vh;
    width: 70vw;
    background-color: var(--bg-layout);
    border: 1px solid var(--border);
    border-radius: 1rem;
}

.layout-header {
    font-size: 0.75rem;
    padding: 0.75rem;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid var(--border-muted);
}

.layout-toolbar {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    gap: 0.75rem;
    padding: 0.75rem;
    background: transparent;
    border-bottom: 1px solid var(--border-muted);
}

.layout-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: row;
}

.layout-aside {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 0.75rem;
    width: 18%;
    overflow-y: auto;
    background: transparent;
    border-right: 1px solid var(--border-muted);
}

.layout-section {
    flex: 1 1 auto;
    padding: 1rem;
    min-height: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.layout-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: transparent;
    border-top: 1px solid var(--border-muted);
}

/* Subpage system (shared by pages with footer-tab navigation) */
#subpage-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.subpage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Musetool Nav */
.musetool-nav-container {
    position: fixed;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    gap: 0.75rem;
    z-index: 100;
}

/* ============================================================
   Overlay
============================================================ */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 1000;
}

.overlay-panel {
    background-color: var(--bg-layout);
    border: 1px solid var(--border);
    border-radius: 1rem;
    width: 50vw;
    height: 70vh;
    overflow: hidden;
}

.section-view {
    display: none;
}

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

/* ─── Context Menu ─────────────────────────────────────────────────────────── */

.context-menu {
    position: fixed;
    z-index: 9999;
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    background: var(--bg-layout);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 150px;
    animation: ctx-in 0.1s ease;
}

@keyframes ctx-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.context-menu__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text);
    transition: background 0.1s;
    user-select: none;
}

.context-menu__item:hover {
    background: var(--bg-hover, rgba(255,255,255,0.07));
}

.context-menu__icon {
    width: 1rem;
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.8;
}

.context-menu__separator {
    height: 1px;
    margin: 0.25rem 0;
    background: var(--border);
}

.context-menu__item--danger {
    color: #e05555;
}

.context-menu__item--danger:hover {
    background: rgba(224, 85, 85, 0.12);
}

.context-menu__item--disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

/* ─── Confirm / Modal Dialog ───────────────────────────────────────────────── */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    animation: modal-fade 0.12s ease;
}

@keyframes modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-box {
    background: var(--bg-layout);
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    padding: 1.5rem;
    width: 40vw;
    text-align: center;
    animation: modal-pop 0.14s ease;
}

@keyframes modal-pop {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

.modal-title {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: var(--text);
}

.modal-message {
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    color: var(--text-muted, #999);
    line-height: 1.4;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.modal-btn {
    padding: 0.5rem 1.2rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    background: transparent;
    color: var(--text);
    transition: background 0.1s, border-color 0.1s;
}

.modal-btn--cancel:hover {
    background: var(--bg-hover, rgba(255,255,255,0.07));
}

.modal-btn--confirm {
    background: var(--accent, #4a7cff);
    border-color: var(--accent, #4a7cff);
    color: #fff;
}

.modal-btn--confirm:hover {
    filter: brightness(1.1);
}

.modal-btn--danger {
    background: #e05555;
    border-color: #e05555;
}

/* ─── Admin Console (Settings ▸ Admin) ──────────────────────────────────────── */

.admin-console {
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
    overflow: hidden;
}

.section-view.admin-console.active {
    display: flex;
}

.admin-search {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
}

.admin-results {
    flex: 0 0 auto;
    max-height: 30%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.admin-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-muted);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}

.admin-row:hover {
    background: var(--bg-hover, rgba(255,255,255,0.07));
}

.admin-row__avatar {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

.admin-row__name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-row__role {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

.admin-row__role[data-role="owner"] { color: #c879ff; opacity: 1; }
.admin-row__role[data-role="admin"] { color: var(--accent, #4a7cff); opacity: 1; }
.admin-row__role[data-role="judge"] { color: #d6a13a; opacity: 1; }

.admin-row__banned {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #e05555;
    border: 1px solid #e05555;
    border-radius: 0.35rem;
    padding: 0 0.3rem;
}

.admin-inspector {
    flex: 1 1 auto;
    overflow-y: auto;
}

.admin-empty {
    font-size: 0.85rem;
    color: var(--text-muted, #999);
    margin: 0.5rem 0;
}

.admin-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.admin-card__avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
}

.admin-card__id h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.admin-card__id code {
    font-size: 0.7rem;
    color: var(--text-muted, #999);
    word-break: break-all;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem 1rem;
    margin: 0;
}

.admin-stats > div {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-muted);
    padding-bottom: 0.25rem;
}

.admin-stats dt {
    font-size: 0.75rem;
    color: var(--text-muted, #999);
}

.admin-stats dd {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text);
    text-align: right;
}

.admin-stats dd small {
    color: var(--text-muted, #999);
    font-size: 0.65rem;
}

.admin-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted, #999);
}

.admin-field input {
    width: 4rem;
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
}

.admin-field__label {
    font-size: 0.8rem;
    color: var(--text-muted, #999);
    margin-right: 0.25rem;
}

.admin-action {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s, opacity 0.1s;
}

.admin-action:hover:not(:disabled) {
    background: var(--bg-hover, rgba(255,255,255,0.07));
}

.admin-action:disabled {
    opacity: 0.4;
    cursor: default;
}

.admin-action.is-current {
    border-color: var(--accent, #4a7cff);
    color: var(--accent, #4a7cff);
}

.admin-action.is-danger {
    border-color: #e05555;
    color: #e05555;
}

.admin-action.is-danger:hover:not(:disabled) {
    background: rgba(224, 85, 85, 0.12);
}

.admin-given summary {
    font-size: 0.8rem;
    color: var(--text-muted, #999);
    cursor: pointer;
}

.admin-given ul {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.admin-given li {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text);
}

.admin-given li code {
    color: var(--text-muted, #999);
    word-break: break-all;
}
