/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

/* --- Global Color Palette & Variables --- */
:root {
  /* Primary Colors (from logo & derivatives) */
  --primary-yellow: #FFC93C;
  --primary-brown: #4B2B2B;

  /* Background & Surface Colors */
  --background: #F9F5E9;
  --surface-1: #FFFFFF;
  --surface-2: #F3EFE0;

  /* Text Colors */
  --text-primary: #3D2323;
  --text-secondary: #7A5B5B;
  --text-on-accent: #FFFFFF;

  /* Accent & Status Colors */
  --accent-blue: #2779a7;
  --success: #28a745;
  --danger: #dc3545;

  /* Shadow & Border Colors */
  --shadow-color: rgba(75, 43, 43, 0.1);
  --border-color: #EAE3D2;

  /* Font */
  --font-family: 'Poppins', sans-serif;
}

/* --- Global Styles --- */
body {
    font-family: var(--font-family);
    background-color: var(--background);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
}

/* --- Index.html Specific Styles (Landing Page) --- */
.landing-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.landing-content {
    max-width: 400px;
}

.landing-logo {
    width: 150px;
    height: auto;
}

.landing-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.landing-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.btn-connect {
    background-color: var(--primary-yellow);
    color: var(--primary-brown);
    font-weight: 600;
    font-size: 1.1rem;
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: all 0.3s ease;
}

.btn-connect:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-color);
    color: var(--primary-brown);
}

.btn-connect:disabled {
    background-color: #fddc8c;
    cursor: not-allowed;
}

/* --- Notification Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--surface-1);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    max-width: 90%;
    width: 350px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-content p {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 1rem 0;
    word-wrap: break-word;
}

.modal-content a {
    color: var(--accent-blue);
    text-decoration: none;
    display: block;
    margin-top: -10px;
    margin-bottom: 20px;
}

.btn-modal-close {
    background-color: var(--primary-yellow);
    color: var(--primary-brown);
    font-weight: 600;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}

/* --- App Page Specific Styles --- */
body.app-body {
    padding-top: 80px; /* Space for fixed header */
    padding-bottom: 80px; /* Space for fixed bottom nav */
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: var(--surface-1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    box-shadow: 0 2px 10px var(--shadow-color);
    z-index: 999;
}

.header-logo {
    height: 40px;
}

.wallet-info {
    display: flex;
    align-items: center;
    background-color: var(--surface-2);
    padding: 6px 12px;
    border-radius: 20px;
}

.wallet-address {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 8px;
}

.network-logo {
    height: 24px;
}

.main-container {
    padding: 1.5rem 1rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.info-card {
    background-color: var(--surface-1);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow-color);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
}

.balance-row, .stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

.balance-row:last-child, .stats-row:last-child {
    margin-bottom: 0;
}

.balance-row span, .stats-row span {
    color: var(--text-secondary);
}

.balance-row strong, .stats-row strong {
    color: var(--text-primary);
    font-weight: 600;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-action {
    background-color: var(--primary-yellow);
    color: var(--primary-brown);
    text-align: center;
    font-weight: 600;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.btn-action:hover {
    color: var(--primary-brown);
    transform: scale(1.03);
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: var(--surface-1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px var(--shadow-color);
    z-index: 999;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.nav-item.active {
    color: var(--primary-brown);
    font-weight: 600;
}

.nav-item span {
    font-size: 0.8rem;
    margin-top: 4px;
}

.btn-action.full-width {
    width: 100%;
    margin-top: 1rem;
    box-sizing: border-box;
    display: block;
}

/* --- Stake & Market Page Specific Styles --- */

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-item {
    padding: 10px 20px;
    border: none;
    background-color: transparent;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-item.active {
    color: var(--primary-brown);
    border-bottom-color: var(--primary-yellow);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Stake Form Card */
.stake-form-card {
    background-color: var(--surface-1);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow-color);
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    align-items: center;
    background-color: var(--surface-2);
    border-radius: 12px;
    padding: 5px;
    margin-bottom: 1rem;
    /* FIX: Prevents wrapping issues caused by Bootstrap */
    flex-wrap: nowrap;
}

.input-group input {
    /* FIX: Use flexbox properties instead of width: 100% for better control */
    flex: 1;
    min-width: 0; /* Allows the input to shrink if needed */
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 10px;
    color: var(--text-primary);
}
/* Hide spinner on number input */
.input-group input[type=number]::-webkit-inner-spin-button,
.input-group input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-group input[type=number] {
  -appearance: textfield;
}

#maxBtn {
    background-color: var(--primary-yellow);
    color: var(--primary-brown);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Stakes List */
.stakes-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stake-card {
    background-color: var(--surface-1);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.stake-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stake-id {
    font-weight: 700;
    font-size: 1.1rem;
}

.stake-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-active {
    background-color: #e9f7ec;
    color: var(--success);
}

.status-inactive {
    background-color: #f8f9fa;
    color: #6c757d;
}

.stake-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.progress-bar-container {
    width: 100%;
    background-color: var(--surface-2);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}

.progress-bar {
    height: 100%;
    width: 0%; /* JS will set this */
    background: linear-gradient(90deg, var(--primary-yellow), #ffd66b);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.btn-claim {
    background-color: var(--accent-blue);
    color: var(--text-on-accent);
    text-align: center;
    font-weight: 600;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    border: none;
    width: 100%;
    margin-top: 1rem;
    cursor: pointer;
}

.btn-claim:disabled {
    background-color: #a1c6dd;
    cursor: not-allowed;
}

.placeholder-text {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 0;
}

/* Loader */
.loader-container {
    display: flex;
    justify-content: center;
    padding: 2rem;
}
.loader {
    border: 5px solid var(--surface-2);
    border-top: 5px solid var(--primary-yellow);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Team Page Specific Styles --- */
.referral-link-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.referral-link-input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    background-color: var(--surface-2);
    padding: 10px 15px;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.btn-copy {
    background-color: var(--primary-yellow);
    color: var(--primary-brown);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}
.team-level {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.team-level:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.team-level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}
.level-title {
    color: var(--text-primary);
}
.level-count {
    background-color: var(--surface-2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}