/* =============================================================================
   DartBullz - Globale Stile
   ============================================================================= */

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color var(--transition-slow), color var(--transition-slow);
    overflow-x: hidden;
    min-height: 100vh;
}

/* atmospheric background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 0%, rgba(230, 50, 50, 0.08), transparent 50%),
        radial-gradient(circle at 85% 100%, rgba(45, 165, 90, 0.05), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

[data-theme="light"] body::before {
    background:
        radial-gradient(circle at 15% 0%, rgba(193, 29, 29, 0.04), transparent 50%),
        radial-gradient(circle at 85% 100%, rgba(45, 165, 90, 0.03), transparent 50%);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity var(--transition);
}
a:hover { opacity: 0.8; }

main {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 4rem);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

@media (max-width: 640px) {
    .container { padding: 1rem; }
}

/* Typography */
.section-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.875rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 0.95;
    letter-spacing: 0.01em;
    margin-bottom: 1rem;
}

.section-title .accent { color: var(--accent); }

.section-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 38rem;
    margin-bottom: 3.5rem;
}

/* Loading + Empty states */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    gap: 0.75rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: var(--bg-elev-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.875rem 1.125rem;
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    min-width: 18rem;
    max-width: 24rem;
    pointer-events: auto;
    animation: toastIn 0.3s ease;
    border-left: 3px solid var(--accent);
}

.toast.is-success { border-left-color: var(--success); }
.toast.is-error   { border-left-color: var(--danger); }
.toast.is-warning { border-left-color: var(--warning); }
.toast.is-info    { border-left-color: var(--info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Auth-Layout (Login, Register) */
.auth-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.auth-card {
    width: 100%;
    max-width: 26rem;
    background: var(--bg-elev-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-brand-mark {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--brand-red-bright), var(--brand-red-dark));
    display: grid;
    place-items: center;
    color: white;
    font-family: var(--font-display);
    font-size: 1.5rem;
    box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--brand-red);
}

/* Brand-Logo-Bild Varianten */
.auth-brand-img {
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 0.875rem;
    display: block;
    object-fit: contain;
    /* Im hellen Theme einen subtilen Schatten hinzufügen damit das schwarze Logo nicht "klebt" */
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
}

[data-theme="dark"] .auth-brand-img {
    filter: drop-shadow(0 0 12px rgba(230, 50, 50, 0.25));
}

.brand-logo {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    flex-shrink: 0;
}

.app-sidebar-brand .brand-logo {
    width: 1.875rem;
    height: 1.875rem;
}

.auth-brand-text {
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: 0.02em;
}
.auth-brand-text .a { color: var(--text-primary); }
.auth-brand-text .b { color: var(--accent); }

.auth-meta {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-tertiary);
}
.auth-meta a {
    color: var(--accent);
    font-weight: 600;
}

/* App-Shell (mit Sidebar + Topbar) */
.app-shell {
    display: grid;
    grid-template-columns: 16rem 1fr;
    min-height: 100vh;
}

@media (max-width: 900px) {
    /* Auf Mobile keine Grid-Spalte mehr für die Sidebar - die wird via components.css
       als position:fixed Slide-In-Drawer gerendert. Hier nur noch das Grid anpassen. */
    .app-shell { grid-template-columns: 1fr; }
}

.app-sidebar {
    background: var(--bg-elev-1);
    border-right: 1px solid var(--border-subtle);
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0 0.5rem 1.5rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1rem;
}

.app-sidebar-brand .mark {
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--brand-red-bright), var(--brand-red-dark));
    display: grid;
    place-items: center;
    color: white;
    font-size: 0.875rem;
    font-weight: 800;
    box-shadow: 0 0 0 1px var(--bg-base), 0 0 0 2px var(--brand-red);
}

.nav-section {
    margin-bottom: 1.25rem;
}

.nav-section-title {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    padding: 0 0.625rem;
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
}

.nav-link:hover {
    background: var(--bg-elev-2);
    color: var(--text-primary);
}

.nav-link.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-link svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.app-main {
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.app-topbar-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: 0.02em;
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    transition: background var(--transition);
}

.user-menu-trigger:hover {
    background: var(--bg-elev-2);
}

.user-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-red), var(--brand-red-dark));
    color: white;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
}
