/**
 * StarSafe - Premium Dark Gaming Theme
 * Mobile First CSS
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5542d4;
    --secondary: #00CEC9;
    --success: #00B894;
    --danger: #FF7675;
    --warning: #FDCB6E;

    --bg-dark: #0D0D1A;
    --bg-card: #15152A;
    --bg-card-hover: #1E1E38;
    --bg-modal: #1A1A2E;

    --text-primary: #FFFFFF;
    --text-secondary: #A0A0B8;
    --text-muted: #6B6B80;

    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body {
    padding-top: 60px;
    padding-bottom: calc(70px + var(--safe-area-bottom));
}

/* ===== HEADER ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(180deg, var(--bg-dark) 0%, rgba(13, 13, 26, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-light);
}

.logo i {
    font-size: 24px;
    color: var(--primary);
}

.balance-badge {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 8px 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.balance-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(108, 92, 231, 0.4);
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(70px + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: linear-gradient(180deg, rgba(21, 21, 42, 0.98) 0%, var(--bg-card) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item i {
    font-size: 20px;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active i {
    color: var(--primary-light);
}

/* ===== MAIN CONTENT ===== */
.app-content {
    min-height: calc(100vh - 130px);
}

.section {
    display: none;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 20px;
}

.section-header h2,
.section-title h2,
.section-title h3 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title {
    margin: 24px 0 16px;
}

/* ===== HERO BANNER ===== */
.hero-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, #2d1b69 100%);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.3;
    }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-content h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
}

.hero-content p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(108, 92, 231, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #00d4a4 100%);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* ===== CARDS ===== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.game-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.game-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.game-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.game-icon i {
    font-size: 24px;
    color: white;
}

.game-info h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.game-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.game-badge {
    display: inline-block;
    background: rgba(0, 206, 201, 0.2);
    color: var(--secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 24px;
}

.info-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.info-card i {
    font-size: 24px;
    color: var(--primary-light);
    margin-bottom: 8px;
}

.info-card h4 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.info-card p {
    font-size: 10px;
    color: var(--text-muted);
}

/* ===== WALLET ===== */
.wallet-balance {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-xl);
    padding: 32px;
    text-align: center;
    margin-bottom: 20px;
}

.balance-label {
    display: block;
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 8px;
}

.balance-value {
    display: block;
    font-size: 36px;
    font-weight: 800;
}

.balance-locked {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 12px;
    opacity: 0.7;
}

.wallet-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

/* ===== PROFILE ===== */
.profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.profile-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar i {
    font-size: 30px;
    color: white;
}

.profile-info h3 {
    font-size: 18px;
    font-weight: 700;
}

.profile-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-light);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.profile-menu {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: var(--bg-card-hover);
}

.menu-item i:first-child {
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.menu-item span {
    flex: 1;
}

.menu-item i:last-child {
    color: var(--text-muted);
}

/* ===== MODALS ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    background: var(--bg-modal);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    border: 1px solid var(--border-color);
    border-bottom: none;
}

.modal-sm .modal-content {
    max-height: 50vh;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--bg-card);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-content h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.quick-values {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.quick-values button {
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-values button:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.modal-footer-text {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-footer-text a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
}

.alert-info {
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.3);
    color: var(--primary-light);
}

.alert i {
    margin-top: 2px;
}

/* ===== PIX ===== */
.pix-qr {
    text-align: center;
    margin: 20px 0;
}

.pix-qr img {
    max-width: 200px;
    border-radius: var(--radius-md);
}

.pix-code {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.pix-code input {
    flex: 1;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 12px;
}

.pix-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

/* ===== LOADING ===== */
.loading-placeholder {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading-placeholder i {
    font-size: 32px;
    margin-bottom: 12px;
}

/* ===== LOGIN REQUIRED ===== */
.login-required {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.login-required i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.login-required p {
    margin-bottom: 20px;
}

/* ===== GAME SELECTOR ===== */
.game-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 4px 0;
}

.game-tab {
    flex: 1;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: all 0.2s;
}

.game-tab.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-color: transparent;
}

/* ===== WALLET MINI ===== */
.wallet-balance-mini {
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.wallet-balance-mini span {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.wallet-balance-mini strong {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-light);
}

.wallet-actions-mini {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px 0;
}

/* ===== TOAST ===== */
#toastContainer {
    position: fixed;
    top: 80px;
    left: 16px;
    right: 16px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--danger);
}

.toast span {
    flex: 1;
    font-size: 14px;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
    body {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: var(--shadow-lg);
    }

    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }

    .app-header {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }

    .modal-content {
        border-radius: var(--radius-xl);
        margin: auto;
        border: 1px solid var(--border-color);
    }
}

/* ===== TRANSACTIONS ===== */
.transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}

.tx-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.transaction-item.deposito .tx-icon {
    background: rgba(0, 184, 148, 0.2);
    color: var(--success);
}

.transaction-item.saque .tx-icon {
    background: rgba(253, 203, 110, 0.2);
    color: var(--warning);
}

.transaction-item.aposta .tx-icon {
    background: rgba(108, 92, 231, 0.2);
    color: var(--primary-light);
}

.transaction-item.premio .tx-icon {
    background: rgba(0, 206, 201, 0.2);
    color: var(--secondary);
}

.tx-info {
    flex: 1;
    min-width: 0;
}

.tx-desc {
    display: block;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-date {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.tx-value {
    font-weight: 700;
    font-size: 14px;
}

.tx-value.positive {
    color: var(--success);
}

.tx-value.negative {
    color: var(--text-secondary);
}

.tx-status {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.status-aprovado {
    background: rgba(0, 184, 148, 0.2);
    color: var(--success);
}

.status-pendente {
    background: rgba(253, 203, 110, 0.2);
    color: var(--warning);
}

.status-cancelado {
    background: rgba(255, 118, 117, 0.2);
    color: var(--danger);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    margin-bottom: 4px;
}

/* ===== MATCHES LIST ===== */
.matches-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.match-card:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.match-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.match-creator {
    font-weight: 600;
    font-size: 14px;
}

.match-value {
    color: var(--success);
    font-weight: 700;
    font-size: 16px;
}

/* ===== MOBILE FIXES ===== */
@media (max-width: 480px) {

    /* Transaction items mobile fix */
    .transaction-item {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }

    .tx-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .tx-info {
        flex: 1;
        min-width: 100px;
    }

    .tx-desc {
        font-size: 13px;
    }

    .tx-value {
        font-size: 13px;
    }

    .tx-status {
        font-size: 9px;
        padding: 3px 6px;
    }

    /* Match cards mobile */
    .match-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .match-card .btn {
        width: 100%;
    }

    /* Game panel mobile */
    .game-panel {
        padding: 12px;
    }

    .matches-list {
        gap: 10px;
    }

    /* Quick values mobile */
    .quick-values {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Wallet actions mobile */
    .wallet-actions {
        flex-direction: column;
        gap: 8px;
    }

    .wallet-actions .btn {
        width: 100%;
    }

    /* Stats grid mobile */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 10px;
    }
}

/* Small mobile screens */
@media (max-width: 360px) {
    .transaction-item {
        padding: 10px;
    }

    .tx-icon {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .tx-desc {
        font-size: 12px;
    }

    .tx-value {
        font-size: 12px;
    }

    .balance-value {
        font-size: 28px;
    }

    .hero-content h1 {
        font-size: 22px;
    }
}

.badge-new {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}