/*
  ================================================================================
  Vertex Partner Panel - Unified Stylesheet (Admin Mirror)
  Based on Vertex Admin Panel v2.2 & Arcane Monochrome Theme
  ================================================================================
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* 
  ================================================================================
  THEME VARIABLES (Identical to Admin)
  ================================================================================
*/
:root {
    /* -- Structure & Text -- */
    --bg-color: #0a0a0a;
    --glass-bg: rgba(26, 26, 26, 0.6);
    --text-color: #f5f5f5;
    --primary-accent: #ffffff;
    --secondary-text: #a3a3a3;
    --input-bg: #1a1a1a;
    --border-color: rgba(255, 255, 255, 0.15);
    --disabled-bg: #3f3f46;
    --disabled-text: #71717a;
    --card-bg: rgba(0, 0, 0, 0.2);

    /* -- Semantic Colors -- */
    --error-color: #f43f5e;
    --success-color: #4ade80;
    --info-color: #3b82f6;

    /* -- Animation Particle Color -- */
    --particle-color: rgba(255, 255, 255, 0.05);
}

html[data-theme="light"] {
    /* -- Structure & Text -- */
    --bg-color: #f4f4f5;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --text-color: #1f2937;
    --primary-accent: #111827;
    --secondary-text: #6b7280;
    --input-bg: #ffffff;
    --border-color: rgba(0, 0, 0, 0.1);
    --disabled-bg: #e5e7eb;
    --disabled-text: #9ca3af;
    --card-bg: #ffffff;

    /* -- Animation Particle Color -- */
    --particle-color: rgba(0, 0, 0, 0.05);
}

/* 
  ================================================================================
  CORE LAYOUT & TYPOGRAPHY
  ================================================================================
*/
html {
    font-size: 12.8px;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    color: var(--text-color);
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding: 1rem 0;
}

h1,
h2,
h3,
h4 {
    font-weight: 600;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
    color: var(--secondary-text);
    font-weight: 400;
}

h3 {
    text-align: left;
    margin-bottom: 1.5rem;
    color: var(--secondary-text);
    font-weight: 400;
}

h4 {
    margin-top: 0;
    font-weight: 600;
    color: var(--primary-accent);
}

#login-container h1,
#login-container h2,
.panel-header h2 {
    text-align: center;
}

.panel-header h2 {
    display: inline-block;
}

/* 
  ================================================================================
  BACKGROUND ANIMATION
  ================================================================================
*/
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    margin: 0;
    padding: 0;
}

.bg-animation li {
    position: absolute;
    display: block;
    list-style: none;
    width: 20px;
    height: 20px;
    background: var(--particle-color);
    animation: animateParticles 20s linear infinite;
    bottom: -200px;
    border-radius: 20%;
}

@keyframes animateParticles {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
        border-radius: 20%;
    }

    100% {
        transform: translateY(-120vh) rotate(720deg);
        opacity: 0;
        border-radius: 50%;
    }
}

/* Particle Positions */
.bg-animation li:nth-child(1) {
    left: 10%;
    width: 80px;
    height: 80px;
    animation-delay: 0s;
}

.bg-animation li:nth-child(2) {
    left: 20%;
    width: 30px;
    height: 30px;
    animation-delay: 1.5s;
    animation-duration: 10s;
}

.bg-animation li:nth-child(3) {
    left: 25%;
    width: 10px;
    height: 10px;
    animation-delay: 5.5s;
}

.bg-animation li:nth-child(4) {
    left: 40%;
    width: 60px;
    height: 60px;
    animation-delay: 0s;
    animation-duration: 15s;
}

.bg-animation li:nth-child(5) {
    left: 70%;
    width: 20px;
    height: 20px;
    animation-delay: 3.5s;
}

.bg-animation li:nth-child(6) {
    left: 80%;
    width: 120px;
    height: 120px;
    animation-delay: 1s;
}

.bg-animation li:nth-child(7) {
    left: 32%;
    width: 160px;
    height: 160px;
    animation-delay: 7s;
}

.bg-animation li:nth-child(8) {
    left: 55%;
    width: 20px;
    height: 20px;
    animation-delay: 15s;
    animation-duration: 40s;
}

.bg-animation li:nth-child(9) {
    left: 15%;
    width: 15px;
    height: 15px;
    animation-delay: 2s;
    animation-duration: 30s;
}

.bg-animation li:nth-child(10) {
    left: 90%;
    width: 160px;
    height: 160px;
    animation-delay: 4s;
    animation-duration: 9s;
}

/* 
  ================================================================================
  CONTAINERS & PANELS & TRANSITIONS
  ================================================================================
*/
.container {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    z-index: 1;
}

#partner-panel {
    max-width: 87.5rem;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* --- FADE TRANSITION LOGIC --- */
/* Containers start invisible but occupy space when display is block */
#login-container,
#partner-panel {
    transition: opacity 0.5s ease-in-out;
    opacity: 0;
}

/* This class triggers the fade-in */
.fade-in-active {
    opacity: 1 !important;
}

/* --- ENHANCED PANEL ENTRANCE --- */
#partner-panel.panel-enter {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
    filter: blur(8px);
}

#partner-panel.panel-enter-active {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
    transition: 
        opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.8s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.6s ease-out;
}

.dashboard-layout {
    display: block;
    width: 100%;
}

.dashboard-column {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

html[data-theme="light"] .dashboard-column {
    background: #ffffff;
    border: 1px solid var(--border-color);
}

/* 
  ================================================================================
  FORM ELEMENTS & BUTTONS
  ================================================================================
*/
input,
select {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

button {
    padding: 14px;
    border: 1px solid var(--primary-accent);
    border-radius: 8px;
    background-color: var(--primary-accent);
    color: var(--bg-color);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover {
    background-color: transparent;
    color: var(--primary-accent);
}

#login-btn {
    width: 100%;
}

/* 
  ================================================================================
  HEADER & ACTIONS
  ================================================================================
*/
.main-header-wrapper {
    position: relative;
    margin-bottom: 2rem;
}

.panel-header {
    text-align: center;
}

.header-actions {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

#logout-btn,
#theme-toggle-btn {
    height: 40px;
    border-radius: 12px;
    background-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#logout-btn {
    padding: 0 16px;
    border: 1px solid var(--secondary-text);
    color: var(--secondary-text);
    font-size: 1rem;
}

#logout-btn:hover {
    background-color: var(--primary-accent);
    color: var(--bg-color);
    border-color: var(--primary-accent);
}

#theme-toggle-btn {
    width: 40px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 0;
}

#theme-toggle-btn:hover {
    border-color: var(--primary-accent);
    color: var(--primary-accent);
    background-color: rgba(128, 128, 128, 0.1);
}

#theme-toggle-btn svg {
    position: absolute;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    width: 20px;
    height: 20px;
}

.sun-icon {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
}

.moon-icon {
    transform: translateY(100%) rotate(-90deg);
    opacity: 0;
}

html[data-theme="light"] .sun-icon {
    transform: translateY(-100%) rotate(90deg);
    opacity: 0;
}

html[data-theme="light"] .moon-icon {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
}

/* 
  ================================================================================
  STATS GRID
  ================================================================================
*/
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 0;
}

.stat-card {
    background-color: var(--input-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    border-color: var(--secondary-text);
    transform: translateY(-2px);
}

.stat-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary-text);
    text-align: center;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary-accent);
}

.stat-value.small {
    font-size: 1.2rem;
    font-weight: 500;
}

/* 
  ================================================================================
  DATA TABLES
  ================================================================================
*/
.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--input-bg);
    font-size: 0.95rem;
}

.data-table th {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--secondary-text);
    font-weight: 600;
    text-align: left;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.8rem;
}

html[data-theme="light"] .data-table th {
    background-color: rgba(0, 0, 0, 0.05);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background-color: rgba(128, 128, 128, 0.05);
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--secondary-text);
    font-style: italic;
    background: var(--input-bg);
}

.status-refunded {
    color: var(--error-color);
    font-weight: bold;
}

.status-success {
    color: var(--success-color);
    font-weight: bold;
}

.creator-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
}

/* 
  ================================================================================
  LOADER
  ================================================================================
*/
#app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-out;
}

#app-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

#app-loader p {
    color: var(--text-color);
    margin-top: 25px;
    font-size: 1.2rem;
    animation: text-pulse 2s infinite alternate ease-in-out;
}

.loader-logo {
    animation: logo-pulse 2s infinite alternate ease-in-out;
}

.loader-logo .logo-bg {
    fill: rgba(255, 255, 255, 0.05);
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
}

.loader-logo .logo-line {
    fill: none;
    stroke: var(--primary-accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 235;
    stroke-dashoffset: 235;
    animation: draw-line 2.5s ease-in-out forwards;
}

@keyframes draw-line {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes logo-pulse {
    from {
        transform: scale(0.98);
        opacity: 0.8;
    }

    to {
        transform: scale(1.02);
        opacity: 1;
    }
}

@keyframes text-pulse {
    from {
        opacity: 0.6;
    }

    to {
        opacity: 1;
    }
}

/* 
  ================================================================================
  TOASTS
  ================================================================================
*/
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
}

.toast {
    background-color: var(--input-bg);
    color: var(--text-color);
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 10px;
    border-left: 5px solid var(--primary-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    pointer-events: all;
    min-width: 250px;
    max-width: 350px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.error {
    border-left-color: var(--error-color);
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.info {
    border-left-color: var(--info-color);
}

/* 
  ================================================================================
  SECTION: WELCOME OVERLAY (ARCANE MONOCHROME)
  ================================================================================
*/
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    /* Dark monochrome radial background */
    background: radial-gradient(circle at center, #111111 0%, #000000 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    backdrop-filter: blur(20px);
    transition: opacity 1s ease-out;
}

.welcome-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.welcome-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

/* --- Icon & Glow (White/Gray) --- */
.welcome-icon-wrapper {
    position: relative;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(50px) scale(0.8);
    animation: iconRise 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.2s;
}

.welcome-icon {
    width: 150px;
    height: auto;
    position: relative;
    z-index: 2;
    /* White glow instead of purple */
    filter: drop-shadow(0 0 25px rgba(255, 255, 255, 0.3));
}

.glow-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    /* Subtle white radial gradient */
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    z-index: 1;
    animation: glowPulse 3s infinite alternate;
}

/* --- Text Animation (Silver/White) --- */
.welcome-text {
    color: #fff;
    max-width: 800px;
    margin-bottom: 3rem;
}

.welcome-text h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateX(-50px);
    animation: textSlideIn 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.8s;
}

/* Metallic Silver Highlight */
.welcome-text .highlight {
    background: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-text h2 {
    font-size: 2rem;
    color: #d4d4d8;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateX(-30px);
    animation: textSlideIn 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 1.2s;
}

.welcome-description {
    font-size: 1.2rem;
    color: #a1a1aa;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 1s ease-out forwards;
    animation-delay: 1.8s;
}

/* --- Background Shapes (Subtle Gray) --- */
.welcome-background-shapes .shape {
    position: absolute;
    /* Glassy white/gray gradients */
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    z-index: 0;
    border-radius: 20%;
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    right: 15%;
    animation: floatShape1 20s infinite linear;
}

.shape-2 {
    width: 200px;
    height: 200px;
    bottom: 15%;
    left: 10%;
    animation: floatShape2 15s infinite linear reverse;
}

.shape-3 {
    width: 100px;
    height: 100px;
    top: 40%;
    left: 20%;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.1);
    animation: floatShape3 10s infinite ease-in-out;
}

/* --- Button (Monochrome Premium) --- */
.welcome-btn {
    /* Silver to Dark Gray gradient */
    background: linear-gradient(135deg, #e4e4e7 0%, #71717a 100%);
    color: #000000;
    /* Dark text for contrast */
    font-size: 1.2rem;
    padding: 1rem 3rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    opacity: 0;
    animation: buttonFadeIn 1s ease-out forwards;
    animation-delay: 3.5s;
    font-weight: 700;
}

.welcome-btn.hidden {
    display: none;
}

.welcome-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 15px 35px rgba(255, 255, 255, 0.25);
    background: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
}

/* --- Animation Keyframes --- */
@keyframes iconRise {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes glowPulse {
    from {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(0.8);
    }

    to {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

@keyframes textSlideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes buttonFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatShape1 {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-40px) rotate(180deg);
    }

    100% {
        transform: translateY(0) rotate(360deg);
    }
}

@keyframes floatShape2 {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(30px) rotate(-100deg);
    }

    100% {
        transform: translateY(0) rotate(-360deg);
    }
}

@keyframes floatShape3 {
    0% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(20px, -20px);
    }

    100% {
        transform: translate(0, 0);
    }
}

/* --- Shake Animation --- */
.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* 
  ================================================================================
  RESPONSIVE
  ================================================================================
*/
@media (max-width: 1024px) {
    #partner-panel {
        max-width: 1400px;
        width: 95%;
    }

    .main-header-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
        position: static;
        margin-bottom: 2.5rem;
    }

    .header-actions {
        position: static;
        transform: none;
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .welcome-text h1 {
        font-size: 2.2rem;
    }

    .welcome-text h2 {
        font-size: 1.4rem;
    }

    .welcome-icon {
        width: 100px;
    }

    .shape-1 {
        width: 150px;
        height: 150px;
    }
}

@media (max-width: 640px) {
    #partner-panel {
        padding: 1.5rem 1rem;
    }

    .dashboard-column {
        padding: 1rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .table-responsive {
        overflow-x: scroll;
    }

    .data-table th,
    .data-table td {
        padding: 10px;
        font-size: 0.85rem;
    }

    .stat-value {
        font-size: 1.8rem;
    }
}