/* ============================================
   RYODAN CORE — Main Stylesheet
   Dark Gothic UI for Discord Activity
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg);
    color: var(--text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent-soft); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-glow); }

/* ==================== APP LAYOUT ==================== */
#app {
    display: flex;
    height: 100vh;
    background: 
        radial-gradient(ellipse at top right, rgba(180, 22, 42, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at bottom left, rgba(180, 22, 42, 0.08) 0%, transparent 50%),
        var(--bg);
    position: relative;
    overflow: hidden;
}

/* Subtle animated pulse */
#app::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.7) 100%);
    pointer-events: none;
    z-index: 1;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--surface-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 10;
    position: relative;
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--accent-soft), transparent);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    margin-bottom: 32px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 0 12px var(--accent-glow);
    object-fit: contain;
    background: rgba(0,0,0,0.5);
}

.ryodan-title {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 1px;
    line-height: 1.1;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.ryodan-title small {
    font-size: 10px;
    letter-spacing: 4px;
    opacity: 0.7;
}

/* Navigation */
.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    user-select: none;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-links li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--accent-soft);
    transition: width var(--transition-fast);
    z-index: -1;
    border-radius: var(--radius-sm);
}

.nav-links li:hover {
    color: var(--text);
    transform: translateX(2px);
}
.nav-links li:hover::before { width: 100%; }

.nav-links li.active {
    color: var(--text);
    background: var(--accent-soft);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--accent);
}

/* Sidebar footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-version {
    font-size: 10px;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-align: center;
}

/* ==================== PAGE CONTENT ==================== */
#page-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    scroll-behavior: smooth;
    z-index: 2;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInSlideUp {
    0% { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
    50% { box-shadow: 0 0 40px var(--accent-glow), 0 0 60px rgba(180,22,42,0.2); }
}

@keyframes slideInRight {
    from { transform: translateX(110%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(8px); }
}

.page-animated {
    animation: fadeInSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ==================== LOADING OVERLAY ==================== */
#loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    overflow: hidden;
}

.loading-bg {
    position: absolute;
    inset: 0;
    background-image: url('../images/bg.png');
    background-size: cover;
    background-position: center;
    filter: brightness(0.3);
    z-index: 0;
}

.loading-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.loading-logo {
    width: 80px;
    height: 80px;
    animation: pulseGlow 2s infinite;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.5);
    padding: 4px;
}

.loading-title {
    font-size: 28px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 4px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#loading-overlay p {
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 1px;
}

/* Error state */
.loading-error-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    max-width: 400px;
}

.loading-spider-icon {
    font-size: 64px;
    filter: grayscale(0.5);
}

.loading-error-box h2 {
    color: var(--danger);
}

/* Discord-only block screen */
.discord-only-screen {
    position: fixed;
    inset: 0;
    background-image: url('images/bg.png');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.discord-only-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.discord-only-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 480px;
    padding: 48px 32px;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), var(--shadow-red-strong);
}

.spider-seal {
    font-size: 72px;
    display: block;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 20px var(--accent));
}

.discord-only-content h1 {
    font-size: 32px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 4px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.divider {
    width: 60px;
    height: 2px;
    background: var(--accent);
    margin: 16px auto;
    box-shadow: 0 0 10px var(--accent-glow);
}

.discord-only-content .subtitle {
    font-size: 11px;
    letter-spacing: 4px;
    color: var(--text-soft);
    text-transform: uppercase;
    margin-bottom: 16px;
}

.discord-only-content .description {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 24px;
}

.instruction-box {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    text-align: left;
}

.instruction-box p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 12px;
}

.instruction-box ol {
    padding-left: 20px;
    color: var(--text);
    font-size: 14px;
    line-height: 2;
}

.instruction-box code {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.02), transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.card > * { position: relative; z-index: 1; }

.card.gothic {
    border-top: 1px solid var(--accent);
    box-shadow: 0 8px 32px rgba(0,0,0,0.8), inset 0 1px 0 rgba(180,22,42,0.25);
}

.card.gothic:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.9), inset 0 1px 0 rgba(180,22,42,0.4), var(--shadow-red);
    border-color: var(--accent);
    transform: translateY(-3px);
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
}

h2 {
    font-size: 28px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border), transparent);
}

h3 { font-size: 18px; }

/* ==================== BUTTONS ==================== */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition-fast);
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: rgba(255,255,255,0.1);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 6px 20px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    background: var(--accent-active);
    transform: translateY(1px);
    box-shadow: none;
}

.btn-muted {
    opacity: 0.5;
    cursor: default;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==================== INPUTS ==================== */
input, select, textarea {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: all var(--transition-fast);
    outline: none;
    font-family: var(--font-family);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
    background: rgba(24, 27, 36, 0.95);
}

input::placeholder { color: var(--text-soft); }

select option {
    background: var(--bg-soft);
    color: var(--text);
}

/* ==================== SPINNER ==================== */
.spinner {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.page-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
}

/* ==================== TOASTS ==================== */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    border-left: 3px solid var(--accent);
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0,0,0,0.5);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: auto;
    min-width: 200px;
    max-width: 320px;
}

.toast.hiding { animation: fadeOut 0.35s forwards; }

/* ==================== PROGRESS BARS ==================== */
.progress-bar-wrapper {
    background: var(--surface);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    margin: 12px 0 6px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

/* ==================== XP BAR ==================== */
.xp-bar-wrapper {
    background: var(--surface);
    border-radius: 3px;
    height: 4px;
    overflow: hidden;
    margin: 8px 0 4px;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ff4a6b);
    border-radius: 3px;
    box-shadow: 0 0 6px var(--accent-glow);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-label {
    font-size: 11px;
    color: var(--text-soft);
    letter-spacing: 0.3px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    #app { flex-direction: column; }

    .sidebar {
        width: 100%;
        flex-direction: row;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        min-width: unset;
    }

    .logo { margin-bottom: 0; margin-right: 16px; flex-shrink: 0; }
    .logo-icon { width: 32px; height: 32px; }
    .ryodan-title { font-size: 14px; }
    .sidebar-footer { display: none; }
    .sidebar::after { display: none; }

    .nav-links { flex-direction: row; flex-wrap: nowrap; gap: 4px; }
    .nav-links li { white-space: nowrap; font-size: 12px; padding: 8px 12px; }
    .nav-icon { display: none; }

    #page-content { padding: 20px 16px; }
}
