/* NEXXNET OAuth2 - スタイル */

:root {
    --bg-dark: #0f0f12;
    --bg-card: #16161a;
    --bg-input: #1e1e24;
    --border: #2a2a32;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --discord: #5865f2;
    --success: #22c55e;
    --error: #ef4444;
    --radius: 12px;
    --font: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.container-wide {
    max-width: 560px;
}

.landing-hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero-desc {
    margin-top: 1rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.features-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-top: 1.5rem;
}

.features-list {
    margin: 0;
    padding-left: 1.25rem;
}

.features-list li {
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1rem;
    margin: 0 0 1rem;
}

.app-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.app-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-list li:last-child {
    border-bottom: none;
}

.app-list code {
    font-size: 0.8rem;
}

/* ログインページ */
.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
}

.logo h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.tagline {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.login-desc {
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.btn-discord {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--discord);
    color: white !important;
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-discord:hover {
    background: var(--accent-hover);
}

.discord-icon {
    flex-shrink: 0;
}

.login-note {
    margin: 1.5rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.login-note a {
    color: var(--accent);
}

/* ヘッダー */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
}

.header nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.header nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.header nav a:hover {
    color: var(--text);
}

.btn-logout {
    color: var(--text-muted) !important;
}

/* サイドバーレイアウト */
.layout-sidebar {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar .logo {
    font-size: 1.1rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav a:hover {
    background: var(--bg-input);
    color: var(--text);
}

.sidebar-nav a.active {
    background: rgba(88, 101, 242, 0.15);
    color: var(--accent);
}

.nav-icon {
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.sidebar-logout {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.sidebar-logout:hover {
    color: var(--text);
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.page-inner {
    max-width: 640px;
}

/* ダッシュボード */
.main {
    padding: 2rem 1rem;
}

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
}

.avatar-placeholder {
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
}

.profile-info h1 {
    margin: 0;
    font-size: 1.5rem;
}

.username, .email {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.profile-details {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.profile-details dl {
    margin: 0;
    display: grid;
    gap: 0.5rem;
}

.profile-details dt {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.profile-details dd {
    margin: 0;
    font-family: monospace;
    font-size: 0.9rem;
}

.section {
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 認可ページ */
.authorize-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.authorize-card h1 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.app-name {
    margin-bottom: 0.5rem;
}

.app-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.scope-list {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.scope-list ul {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

.scope-list code {
    font-size: 0.85rem;
}

.user-preview {
    margin: 1rem 0;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.authorize-form {
    margin-top: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
}

/* ボタン */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* フォーム */
.form {
    max-width: 480px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-readonly {
    opacity: 0.8;
    cursor: not-allowed;
}

.form-hint {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-section {
    font-size: 1rem;
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.form-section:first-of-type {
    margin-top: 0;
}

.btn-copy-sm {
    margin-left: 0.5rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
}

/* スマホ対応 */
@media (max-width: 768px) {
    .layout-sidebar {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        min-width: auto;
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-header {
        width: 100%;
    }
    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }
    .sidebar-nav a {
        padding: 0.5rem 1rem;
    }
    .sidebar-footer {
        margin-left: auto;
        border-top: none;
    }
}

/* アラート */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert .warning {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-copy {
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
}

/* ドキュメント */
.doc-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.doc-section h2, .doc-section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.doc-section dl {
    margin: 0 0 1rem;
}

.doc-section dt {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.doc-section dd {
    margin: 0.25rem 0 0.75rem;
}

.doc-section pre {
    background: var(--bg-input);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85rem;
}

code {
    background: var(--bg-input);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

/* エラー */
.error-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
}

.error-card h1 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.error-card a {
    color: var(--accent);
    margin-top: 1rem;
    display: inline-block;
}

/* 認可ページ（大きく表示） */
.page-authorize {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.authorize-page {
    max-width: 520px;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.authorize-hero {
    margin-bottom: 2rem;
}

.app-info-card {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.app-tags {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.app-tag {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.app-tag-verified {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.app-tag-official {
    background: rgba(88, 101, 242, 0.2);
    color: var(--accent);
}

.app-name-large {
    font-size: 1.75rem;
    margin: 0 0 0.75rem;
}

.app-desc-large {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 0.5rem;
    line-height: 1.6;
}

.app-website {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.app-website a {
    color: var(--accent);
}

.app-contact {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.authorize-request {
    margin-bottom: 1.5rem;
}

.authorize-title {
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
}

.authorize-warning {
    color: #f59e0b;
    font-size: 0.9rem;
    margin: 0 0 1rem;
}

.scope-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.scope-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.scope-card strong {
    font-size: 0.95rem;
}

.scope-card span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.authorize-user {
    margin-bottom: 1.5rem;
}

.authorize-user p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}

.user-badge-large {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border-radius: 8px;
}

.avatar-md {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.form-actions-large {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* フォーム拡張 */
.checkbox-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.scope-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.scope-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    background: var(--bg-input);
    border-radius: 8px;
    font-size: 0.9rem;
}

.scope-checkbox input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

/* アプリ一覧・連携管理 */
.app-list-detailed {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
}

.app-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.app-list-item-main h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.app-list-item-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.app-meta {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.empty-state {
    padding: 2rem;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 1rem;
}

.empty-state p {
    margin: 0 0 1rem;
}
