/* =====================================================
   AVUIX Gaming Platform — components.css
   Reusable UI components: buttons, cards, inputs,
   badges, tooltips, skeletons, alerts, and more.
   ===================================================== */

/* =====================================================
   BUTTONS (.btn)
   ===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s var(--ease-smooth, ease),
                box-shadow 0.2s var(--ease-smooth, ease),
                background 0.2s var(--ease-smooth, ease),
                opacity 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Ripple pseudo-element */
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.08);
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: inherit;
}

.btn:hover::before {
    opacity: 1;
}

/* --- Primary (purple gradient) --- */
.btn-primary {
    background: linear-gradient(135deg, #8b00d4, var(--purple, #bc13fe));
    color: #fff;
    box-shadow: 0 4px 20px rgba(188, 19, 254, 0.35),
                0 0 0 1px rgba(188, 19, 254, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(188, 19, 254, 0.6),
                0 0 0 1px rgba(188, 19, 254, 0.5);
}

/* --- Secondary (green accent) --- */
.btn-secondary {
    background: linear-gradient(135deg, #00cc6a, var(--green, #00ff88));
    color: #050208;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 255, 136, 0.55);
}

/* --- Outline --- */
.btn-outline {
    background: transparent;
    color: var(--purple, #bc13fe);
    border: 1px solid var(--purple, #bc13fe);
    box-shadow: 0 0 10px rgba(188, 19, 254, 0.1),
                inset 0 0 10px rgba(188, 19, 254, 0.05);
}

.btn-outline:hover {
    background: rgba(188, 19, 254, 0.1);
    box-shadow: 0 0 20px rgba(188, 19, 254, 0.4),
                inset 0 0 15px rgba(188, 19, 254, 0.08);
    transform: translateY(-2px);
}

.btn-outline-green {
    background: transparent;
    color: var(--green, #00ff88);
    border: 1px solid var(--green, #00ff88);
}

.btn-outline-green:hover {
    background: rgba(0, 255, 136, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
    transform: translateY(-2px);
}

/* --- Ghost --- */
.btn-ghost {
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    border: none;
    box-shadow: none;
    padding: 12px 16px;
}

.btn-ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

/* --- Size Variants --- */
.btn-sm {
    padding: 8px 18px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 16px 40px;
    font-size: 1.05rem;
    border-radius: 10px;
    letter-spacing: 1px;
}

/* --- Loading State --- */
.btn-loading {
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rotateContinuous 0.75s linear infinite;
}

/* Ensure rotateContinuous is available even if animations.css not loaded */
@keyframes rotateContinuous {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* =====================================================
   CARDS (.card)
   ===================================================== */

.card {
    background: var(--glass, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border, rgba(188, 19, 254, 0.2));
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--ease-smooth, ease),
                box-shadow 0.3s var(--ease-smooth, ease),
                border-color 0.3s ease;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(188, 19, 254, 0.4),
        transparent
    );
}

/* Hover lift variant */
.card-hover:hover {
    transform: translateY(-6px);
    border-color: rgba(188, 19, 254, 0.5);
    box-shadow: 0 16px 50px rgba(188, 19, 254, 0.2),
                0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Featured card with gradient border */
.card-featured {
    border: 1px solid transparent;
    background-clip: padding-box;
    position: relative;
}

.card-featured::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 17px;
    background: linear-gradient(135deg, var(--purple, #bc13fe), var(--green, #00ff88));
    z-index: -1;
}

/* Full glassmorphic card */
.card-glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.card-glass:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(188, 19, 254, 0.35);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5),
                0 0 30px rgba(188, 19, 254, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Card image area */
.card-image {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}

.card-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s var(--ease-smooth, ease);
}

.card:hover .card-image img {
    transform: scale(1.04);
}

.card-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: #fff;
    margin: 0 0 8px;
}

.card-body {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.88rem;
    line-height: 1.6;
}

.card-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* =====================================================
   INPUT FIELDS (.input-field)
   ===================================================== */

.input-field {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(188, 19, 254, 0.25);
    border-radius: 8px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.25s ease,
                box-shadow 0.25s ease,
                background 0.25s ease;
    caret-color: var(--purple, #bc13fe);
}

.input-field::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.input-field:hover {
    border-color: rgba(188, 19, 254, 0.45);
    background: rgba(255, 255, 255, 0.05);
}

.input-field:focus {
    border-color: var(--purple, #bc13fe);
    box-shadow: 0 0 0 3px rgba(188, 19, 254, 0.2),
                0 0 20px rgba(188, 19, 254, 0.15);
    background: rgba(188, 19, 254, 0.04);
}

/* Input group (label + input wrapper) */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Error state */
.input-error {
    border-color: var(--red, #ff3333) !important;
    box-shadow: 0 0 0 3px rgba(255, 51, 51, 0.15) !important;
}

.input-error-msg {
    font-size: 0.8rem;
    color: var(--red, #ff3333);
    margin-top: 4px;
}

/* Success state */
.input-success {
    border-color: var(--green, #00ff88) !important;
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.15) !important;
}

.input-success-msg {
    font-size: 0.8rem;
    color: var(--green, #00ff88);
    margin-top: 4px;
}

/* Textarea */
.input-field.textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

/* =====================================================
   SKELETON LOADERS (.skeleton)
   ===================================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(188, 19, 254, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 75%
    );
    background-size: 800px 100%;
    animation: shimmer 1.6s infinite linear;
    border-radius: 6px;
    display: block;
}

@keyframes shimmer {
    0%   { background-position: -800px 0; }
    100% { background-position:  800px 0; }
}

.skeleton-text {
    height: 14px;
    width: 100%;
    margin-bottom: 10px;
    border-radius: 4px;
}

.skeleton-text.short  { width: 60%; }
.skeleton-text.medium { width: 80%; }

.skeleton-card {
    height: 220px;
    width: 100%;
    border-radius: 16px;
}

.skeleton-circle {
    border-radius: 50%;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.skeleton-title {
    height: 22px;
    width: 70%;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-button {
    height: 44px;
    width: 140px;
    border-radius: 8px;
}

/* =====================================================
   BADGES (.badge)
   ===================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.4;
}

.badge-purple {
    background: rgba(188, 19, 254, 0.18);
    color: var(--purple, #bc13fe);
    border: 1px solid rgba(188, 19, 254, 0.35);
}

.badge-green {
    background: rgba(0, 255, 136, 0.12);
    color: var(--green, #00ff88);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.badge-red {
    background: rgba(255, 51, 51, 0.15);
    color: var(--red, #ff3333);
    border: 1px solid rgba(255, 51, 51, 0.3);
}

.badge-orange {
    background: rgba(255, 140, 0, 0.15);
    color: var(--orange, #ff8c00);
    border: 1px solid rgba(255, 140, 0, 0.3);
}

.badge-blue {
    background: rgba(0, 204, 255, 0.12);
    color: var(--blue, #00ccff);
    border: 1px solid rgba(0, 204, 255, 0.3);
}

.badge-outline {
    background: transparent;
    border: 1px solid currentColor;
    opacity: 0.85;
}

/* =====================================================
   TAGS (.tag)
   ===================================================== */

.tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background 0.2s ease,
                color 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.tag:hover {
    color: #fff;
    background: rgba(188, 19, 254, 0.1);
    border-color: rgba(188, 19, 254, 0.4);
}

.tag.active {
    background: rgba(188, 19, 254, 0.2);
    color: var(--purple, #bc13fe);
    border-color: var(--purple, #bc13fe);
    box-shadow: 0 0 12px rgba(188, 19, 254, 0.25);
}

/* =====================================================
   PROGRESS BAR (.progress-bar)
   ===================================================== */

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--purple, #bc13fe),
        var(--green, #00ff88)
    );
    border-radius: 999px;
    transition: width 0.6s var(--ease-smooth, ease);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 30px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    filter: blur(4px);
}

/* Animated shimmer on progress bar */
.progress-animated .progress-fill {
    background: linear-gradient(
        90deg,
        var(--purple, #bc13fe),
        var(--green, #00ff88),
        var(--purple, #bc13fe)
    );
    background-size: 200% 100%;
    animation: gradientShift 2s linear infinite;
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Labels */
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
}

/* =====================================================
   TOOLTIP (.tooltip-wrap)
   ===================================================== */

.tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-wrap .tooltip-text {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(30, 10, 50, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(188, 19, 254, 0.4);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    padding: 7px 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5),
                0 0 12px rgba(188, 19, 254, 0.2);
}

.tooltip-wrap .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(188, 19, 254, 0.4);
}

.tooltip-wrap:hover .tooltip-text,
.tooltip-wrap:focus-within .tooltip-text {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =====================================================
   DIVIDER (.divider)
   ===================================================== */

.divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(188, 19, 254, 0.5),
        rgba(0, 255, 136, 0.3),
        transparent
    );
    border: none;
    margin: 32px 0;
    position: relative;
}

.divider::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30%;
    height: 1px;
    background: rgba(188, 19, 254, 0.7);
    filter: blur(2px);
}

/* Divider with centred text */
.divider-text {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 32px 0;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(188, 19, 254, 0.4));
}

.divider-text::after {
    background: linear-gradient(90deg, rgba(188, 19, 254, 0.4), transparent);
}

/* =====================================================
   SCROLL-TO-TOP BUTTON (#scrollTop)
   ===================================================== */

#scrollTop {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(188, 19, 254, 0.6), rgba(0, 255, 136, 0.3));
    border: 1px solid rgba(188, 19, 254, 0.5);
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    pointer-events: none;
    transition: opacity 0.3s ease,
                transform 0.3s var(--ease-spring, ease),
                box-shadow 0.3s ease;
    box-shadow: 0 4px 20px rgba(188, 19, 254, 0.3);
    -webkit-user-select: none;
    user-select: none;
}

#scrollTop.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#scrollTop:hover {
    box-shadow: 0 8px 30px rgba(188, 19, 254, 0.6),
                0 0 20px rgba(0, 255, 136, 0.2);
    transform: translateY(-3px) scale(1.08);
}

#scrollTop:active {
    transform: scale(0.95);
}

/* =====================================================
   PAGE HEADER (.page-header)
   ===================================================== */

.page-header {
    width: 100%;
    padding: 48px 24px 36px;
    text-align: center;
    position: relative;
}

.page-header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(188, 19, 254, 0.5),
        transparent
    );
}

.page-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--purple, #bc13fe) 60%, var(--green, #00ff88) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 12px;
    letter-spacing: 2px;
    line-height: 1.2;
}

.page-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 0.8rem;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item:hover {
    color: var(--purple, #bc13fe);
}

.breadcrumb-item.active {
    color: var(--purple, #bc13fe);
    font-weight: 600;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    margin: 0 8px;
    color: rgba(188, 19, 254, 0.4);
}

/* =====================================================
   SECTION TITLE (.section-title)
   ===================================================== */

.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.3rem, 3vw, 2rem);
    font-weight: 700;
    color: #fff;
    margin: 0 0 32px;
    position: relative;
    display: inline-block;
    letter-spacing: 1.5px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        var(--purple, #bc13fe),
        var(--green, #00ff88),
        transparent
    );
    border-radius: 2px;
}

.section-title.centered {
    display: block;
    text-align: center;
}

.section-title.centered::after {
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
}

/* =====================================================
   STATS ROW (.stats-row)
   ===================================================== */

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
}

.stats-row .stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stats-row .stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--purple, #bc13fe);
    line-height: 1;
}

.stats-row .stat-value.green {
    color: var(--green, #00ff88);
}

.stats-row .stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =====================================================
   ALERT / NOTIFICATION (.alert)
   ===================================================== */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    border: 1px solid;
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    border-radius: 10px 0 0 10px;
    background: currentColor;
}

.alert-success {
    background: rgba(0, 255, 136, 0.08);
    border-color: rgba(0, 255, 136, 0.35);
    color: var(--green, #00ff88);
}

.alert-error {
    background: rgba(255, 51, 51, 0.08);
    border-color: rgba(255, 51, 51, 0.35);
    color: var(--red, #ff3333);
}

.alert-warning {
    background: rgba(255, 204, 0, 0.08);
    border-color: rgba(255, 204, 0, 0.35);
    color: var(--yellow, #ffcc00);
}

.alert-info {
    background: rgba(0, 204, 255, 0.08);
    border-color: rgba(0, 204, 255, 0.35);
    color: var(--blue, #00ccff);
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    margin-top: 1px;
}

.alert-body {
    flex: 1;
    color: rgba(255, 255, 255, 0.85);
}

.alert-body strong {
    color: inherit;
    display: block;
    margin-bottom: 3px;
    font-weight: 600;
}

.alert-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.alert-close:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* =====================================================
   RESPONSIVE ADJUSTMENTS
   ===================================================== */

@media (max-width: 640px) {
    .btn-lg {
        padding: 14px 28px;
        font-size: 0.95rem;
    }

    .card {
        padding: 18px;
        border-radius: 12px;
    }

    #scrollTop {
        bottom: 20px;
        right: 20px;
        width: 42px;
        height: 42px;
    }

    .page-header {
        padding: 32px 16px 24px;
    }

    .stats-row {
        gap: 16px;
    }

    .stats-row .stat-value {
        font-size: 1.3rem;
    }
}
