/* ========== 开发者模式样式 ========== */

/* 开发者入口按钮 - 顶部栏 */
.topbar-identity {
    position: absolute;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-identity .topbar-brand {
    position: static;
}

.dev-mode-toggle {
    display: flex;
    align-items: center;
}

.dev-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 34px;
    padding: 3px 12px 3px 4px;
    background: rgba(255,255,255,0.1);
    color: #f8fafc;
    border: 1px solid rgba(255,212,71,0.28);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 6px 16px rgba(0,0,0,0.18);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.dev-btn:hover {
    color: #fff;
    border-color: rgba(255,212,71,0.58);
    background: rgba(255,255,255,0.16);
    transform: translateY(-1px);
}

.dev-btn.active {
    color: var(--nav-gold);
    border-color: rgba(255,212,71,0.68);
    background: rgba(255,212,71,0.12);
}

.dev-user-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    color: #111827;
    border: 1px solid rgba(255,212,71,0.32);
}

.dev-btn-icon {
    width: 16px;
    height: 16px;
}

.dev-btn-label {
    line-height: 1;
}

.dev-btn.active .dev-user-icon {
    color: #111827;
    border-color: rgba(255,212,71,0.5);
}

.topbar-identity .brand-text {
    background: linear-gradient(180deg, #fffdf6 0%, #fff3c4 42%, #ead18f 72%, #b98b37 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.sidebar-admin-item {
    display: none;
}

.dev-mode-active .sidebar-admin-item {
    display: flex;
}

/* ========== 登录 Modal ========== */
.dev-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.dev-modal-overlay.show {
    display: flex;
}

.dev-modal {
    background: var(--bg-card-solid);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 360px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.dev-modal h3 {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text);
}

.dev-modal .modal-desc {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 20px;
}

.dev-modal .modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    background: var(--bg);
    box-sizing: border-box;
}

.dev-modal .modal-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.dev-modal .modal-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.dev-modal .modal-error.show {
    display: block;
}

.dev-modal .modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.dev-modal .modal-btn {
    flex: 1;
    padding: 10px 0;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s;
    font-family: inherit;
}

.dev-modal .modal-btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
}

.dev-modal .modal-btn-primary:hover {
    transform: translateY(-1px);
}

.dev-modal .modal-btn-cancel {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.dev-modal .modal-btn-cancel:hover {
    background: var(--bg-card-hover);
}

/* ========== 开发者工具栏 ========== */
.dev-toolbar {
    display: none;
    background: linear-gradient(135deg, rgba(249,115,22,0.1), rgba(245,158,11,0.08));
    border-bottom: 1px solid rgba(249,115,22,0.15);
    padding: 10px 24px;
    align-items: center;
    justify-content: space-between;
}

.dev-toolbar.show {
    display: flex;
}

.dev-toolbar .dev-toolbar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dev-toolbar .dev-toolbar-actions {
    display: flex;
    gap: 8px;
}

.dev-toolbar .dev-toolbar-btn {
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.15s;
}

.dev-toolbar .dev-toolbar-btn-primary {
    background: var(--accent);
    color: #fff;
}

.dev-toolbar .dev-toolbar-btn-primary:hover {
    background: #e9650a;
}

.dev-toolbar .dev-toolbar-btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.dev-toolbar .dev-toolbar-btn-secondary:hover {
    background: var(--bg-card-hover);
}

/* ========== 管理页面样式 ========== */
.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 16px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.admin-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.admin-section {
    background: var(--bg-card-solid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

.admin-section-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.admin-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
}

.admin-table td {
    color: var(--text);
}

.admin-table tr:hover td {
    background: var(--bg);
}

.admin-table .admin-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.admin-form {
    padding: 20px;
}

.admin-form .form-group {
    margin-bottom: 16px;
}

.admin-form .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.admin-form .form-group input,
.admin-form .form-group textarea,
.admin-form .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    font-family: inherit;
    background: var(--bg);
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.admin-form .form-group input:focus,
.admin-form .form-group textarea:focus,
.admin-form .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.admin-form .form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.admin-form .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.admin-form .form-actions button {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.admin-form .form-actions .btn-save {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
}

.admin-form .form-actions .btn-save:hover {
    transform: translateY(-1px);
}

.admin-form .form-actions .btn-cancel {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.admin-form .form-actions .btn-cancel:hover {
    background: var(--bg-card-hover);
}

.admin-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.admin-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    animation: fadeSlideIn 0.3s ease;
    display: none;
}

.admin-toast.show {
    display: block;
}

.admin-toast.success {
    background: rgba(34,197,94,0.95);
    color: #fff;
}

.admin-toast.error {
    background: rgba(239,68,68,0.95);
    color: #fff;
}

/* ========== 动画 ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 移动端适配 ========== */
@media (max-width: 900px) {
    .topbar-identity {
        position: static;
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .topbar-identity .topbar-brand {
        position: static;
        min-width: 0;
        font-size: 1em;
    }

    .topbar-identity .brand-text {
        max-width: 92px;
    }

    .dev-btn {
        height: 32px;
        padding: 3px 10px 3px 4px;
        font-size: 12px;
        gap: 6px;
        flex: 0 0 auto;
    }

    .dev-user-icon {
        width: 24px;
        height: 24px;
    }

    .dev-btn-icon {
        width: 16px;
        height: 16px;
    }

    .dev-toolbar {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .dev-toolbar .dev-toolbar-title {
        font-size: 12px;
    }

    .dev-toolbar .dev-toolbar-btn {
        padding: 5px 12px;
        font-size: 12px;
    }

    .admin-container {
        padding: 16px 8px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .topbar-identity .brand-text {
        max-width: 142px;
    }

    .dev-btn {
        width: 32px;
        height: 32px;
        padding: 3px;
    }

    .dev-btn-label {
        display: none;
    }
}

/* Mobile shell override: keep desktop unchanged, force phone/tablet browsers into drawer layout. */
@media (max-width: 1024px) {
    body {
        overflow-x: hidden;
    }

    .topbar-inner {
        justify-content: flex-start !important;
        gap: 10px !important;
        padding: 0 12px !important;
    }

    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        order: 0;
        color: var(--nav-gold);
        background:
            radial-gradient(circle at 35% 25%, rgba(255,255,255,0.18), transparent 42%),
            rgba(255,212,71,0.1);
        border: 1px solid rgba(255,212,71,0.32);
        border-radius: 999px;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 6px 16px rgba(0,0,0,0.16);
        transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    }

    .mobile-menu-btn:active {
        transform: scale(0.96);
        background: rgba(255,212,71,0.16);
        border-color: rgba(255,212,71,0.55);
    }

    .mobile-menu-btn svg {
        width: 19px;
        height: 19px;
        display: block;
    }

    .topbar-identity {
        position: static !important;
        left: auto !important;
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
        max-width: calc(100vw - 74px);
    }

    .topbar-identity .topbar-brand {
        position: static !important;
        min-width: 0;
        flex: 0 1 auto;
    }

    .topbar-identity .brand-text {
        display: block;
        max-width: 168px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-nav {
        display: none !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: auto !important;
        width: min(86vw, 320px) !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        padding-top: var(--topbar-height) !important;
        overflow: hidden !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 2000 !important;
        box-shadow: none !important;
        border-right: 1px solid rgba(255,255,255,0.08) !important;
    }

    .sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 8px 0 40px rgba(0,0,0,0.4) !important;
    }

    .sidebar::after {
        display: none !important;
    }

    .sidebar-nav {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .app-layout {
        display: block !important;
        padding-top: var(--topbar-height) !important;
    }

    .main-content,
    .footer {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .mobile-overlay.show {
        display: block !important;
    }
}
