:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-hover: #4f46e5;
    --accent: #f43f5e;
    --accent-light: #fb7185;
    --success: #10b981;
    --warning: #fbbf24;

    /* Default Light Theme Variables */
    --bg-dark: #f8fafc;
    --bg-gradient-1: rgba(99, 102, 241, 0.1);
    --bg-gradient-2: rgba(244, 63, 94, 0.08);
    --bg-glass: rgba(255, 255, 255, 0.95);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass-border: rgba(99, 102, 241, 0.1);
    --glass-border-light: rgba(0, 0, 0, 0.03);
    --input-bg: rgba(255, 255, 255, 0.9);
    --card-shadow: rgba(99, 102, 241, 0.12);
    --icon-deco: rgba(0, 0, 0, 0.04);
    --scrollbar-thumb: rgba(0, 0, 0, 0.1);
}

[data-theme='dark'] {
    --bg-dark: #070b14;
    --bg-gradient-1: rgba(99, 102, 241, 0.15);
    --bg-gradient-2: rgba(244, 63, 94, 0.1);
    --bg-glass: rgba(15, 23, 42, 0.95);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-light: rgba(255, 255, 255, 0.05);
    --input-bg: rgba(0, 0, 0, 0.3);
    --card-shadow: rgba(0, 0, 0, 0.7);
    --icon-deco: rgba(255, 255, 255, 0.03);
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

.no-transition * {
    transition: none !important;
    animation: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

.auth-page-body {
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px;
    width: 100%;
    box-shadow: 0 25px 50px -12px var(--card-shadow);
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    transition: background 0.5s ease, border 0.5s ease, box-shadow 0.5s ease;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg,
            transparent,
            rgba(255, 255, 255, 0.03),
            transparent);
    transition: 0.5s;
    pointer-events: none;
}

.glass-card:hover::before {
    left: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes simpleFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.logo-container h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1.5px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-style {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 20px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-style:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-glass);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 18px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.5);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

/* Panel Layout Improvements - Top Navigation */
.panel-container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 20px 40px;
    min-height: 100vh;
}

.sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 25px;
    background: var(--bg-glass);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    flex-direction: row !important;
}

.main-content {
    width: 100%;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 50px;
    animation: simpleFade 0.6s ease-out forwards;
}

.sidebar nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 20px;
}

.nav-item {
    padding: 10px 15px;
    border-radius: 12px;
    margin-bottom: 0;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.nav-item i {
    font-size: 1.1rem;
}

.sidebar-user {
    margin-bottom: 0 !important;
    padding: 6px 15px !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.02) !important;
}

.sidebar-user .user-avatar {
    width: 36px !important;
    height: 36px !important;
    font-size: 1rem !important;
}

.sidebar-user h4 {
    font-size: 0.85rem !important;
}

.sidebar-user p {
    font-size: 0.7rem !important;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: translateY(-2px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0.05) 100%);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.user-avatar {
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    color: #fff;
    font-weight: 800;
}

.badge {
    padding: 5px 12px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.error-msg {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: #fb7185;
    padding: 16px;
    border-radius: 16px;
    font-weight: 600;
    text-align: center;
}

/* --- Advanced Responsive & UI System --- */

/* Base container fixes */
.panel-container {
    width: 100%;
    max-width: 1440px;
    padding: 20px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Glass Card Responsive Padding */
.glass-card {
    padding: 40px;
}

/* Stat Grid - Intelligent Layout */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

/* Sidebar / Header - Transition to Mobile */
.sidebar {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Desktop Fix (No horizontal scroll) */
body {
    overflow-x: hidden;
}

/* --- Breakpoints --- */

/* Laptop & Tablet Landscape */
@media (max-width: 1200px) {
    .panel-container {
        padding: 15px;
    }

    .main-content {
        padding: 35px;
        border-radius: 28px;
    }
}

/* Tablet Portrait */
@media (max-width: 992px) {
    .sidebar {
        padding: 12px 15px;
    }

    .sidebar nav {
        gap: 5px;
    }

    .nav-item {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    .profile-header-container {
        justify-content: center;
        text-align: center;
    }

    .profile-header-container p {
        justify-content: center;
    }

    .sidebar {
        flex-direction: column !important;
        align-items: center;
        gap: 15px;
        position: relative;
        top: 0;
        border-radius: 24px;
        margin-bottom: 10px;
    }

    .sidebar nav {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        margin: 0;
    }

    .nav-item {
        flex: 1 0 45%;
        justify-content: center;
        margin: 2px;
    }

    .sidebar-user {
        width: 100%;
        justify-content: center !important;
        background: rgba(255, 255, 255, 0.05) !important;
    }

    .main-content {
        padding: 20px;
        border-radius: 20px;
    }

    .stat-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .glass-card {
        padding: 25px;
    }

    h2 {
        font-size: 1.8rem !important;
        text-align: center;
    }

    /* Activity Items Mobile */
    .token-item {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
        padding: 20px !important;
    }

    .token-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
        padding-top: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }
}

/* Small Phones */
@media (max-width: 480px) {
    .nav-item span {
        display: none;
        /* Only icons on very small screens? No, maybe small text */
    }

    .nav-item {
        padding: 12px;
    }

    .nav-item i {
        font-size: 1.3rem;
    }

    .sidebar-user .user-details {
        display: none;
    }

    .logo-container h1 {
        font-size: 1.8rem;
    }
}

/* Fix for Grid Items with Inline Styles */
.responsive-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 992px) {
    .responsive-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* --- Toast Notification System --- */
.toast-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 2147483647 !important;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
}

.toast {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 16px 24px;
    border-radius: 18px;
    color: var(--text-main);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 320px;
    max-width: 450px;
    pointer-events: auto;
    animation: toastIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    position: relative;
    overflow: hidden;
}

.toast.hiding {
    animation: toastOut 0.5s cubic-bezier(0.175, 0.885, 0.32, 1) forwards;
}

.toast-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.toast-error .toast-icon {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
}

.toast-info .toast-icon {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    width: 100%;
    transform-origin: left;
}

.toast-success .toast-progress {
    background: #10b981;
}

.toast-error .toast-progress {
    background: #f43f5e;
}

@keyframes toastIn {
    from {
        transform: translateX(100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    to {
        transform: translateX(100px);
        opacity: 0;
    }
}

@keyframes progressLoad {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Hide legacy error-msg if Toast is used */
.error-msg.hidden {
    display: none;
}

.modal-backdrop {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2147483647 !important;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    padding: 20px;
    margin: 0 !important;
    overscroll-behavior: contain;
    transition: all 0.3s ease;
}

.modal-backdrop.active {
    display: flex !important;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    width: 100%;
    max-width: 520px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    margin: 0 !important;
    animation: modalIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    z-index: 2147483647;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 32px;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-header {
    padding: 20px 40px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
    border-color: rgba(244, 63, 94, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 15px 35px 20px 40px;
    overflow-y: auto;
    flex: 1;
    border-right: 1px solid rgba(255, 255, 255, 0.03);
}

/* Custom Scrollbar for Modal Body - High Visibility */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.4);
    /* Based on primary color */
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.modal-footer {
    padding: 0 40px 30px;
    display: flex;
    gap: 12px;
}

/* Modal Input Adjustments */
.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-left: 5px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(30px);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* --- Premium OIDC Buttons --- */
.oidc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 58px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    color: var(--text-main);
    text-decoration: none !important;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 12px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.oidc-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.oidc-btn:active {
    transform: translateY(0);
}

.oidc-btn i {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

.oidc-btn:hover i {
    transform: scale(1.15);
}

/* Specific Brand Styling */
.oidc-btn.google {
    border-color: rgba(66, 133, 244, 0.2);
}

.oidc-btn.google i {
    color: #4285F4;
}

.oidc-btn.google:hover {
    background: rgba(66, 133, 244, 0.08);
    border-color: rgba(66, 133, 244, 0.4);
}

.oidc-btn.microsoft {
    border-color: rgba(0, 164, 239, 0.2);
}

.oidc-btn.microsoft i {
    color: #00a4ef;
}

.oidc-btn.microsoft:hover {
    background: rgba(0, 164, 239, 0.08);
    border-color: rgba(0, 164, 239, 0.4);
}

.oidc-btn.github {
    border-color: rgba(255, 255, 255, 0.1);
}

.oidc-btn.github i {
    color: #fff;
}

.oidc-btn.github:hover {
    background: rgba(255, 255, 255, 0.1);
}

.oidc-btn.discord {
    border-color: rgba(88, 101, 242, 0.2);
}

.oidc-btn.discord i {
    color: #5865f2;
}

.oidc-btn.discord:hover {
    background: rgba(88, 101, 242, 0.08);
    border-color: rgba(88, 101, 242, 0.4);
}