/* ============================================================
   main.css — PLAY MY v8.5.0
   Variáveis, reset, layout base, header, sidebar, seções.
   Deve ser o PRIMEIRO CSS a carregar.
   ============================================================ */
/* ============ VARIÁVEIS GLOBAIS ============ */
:root {
  --apple-green: #34c759; --apple-green-light: #30d158;
  --apple-blue: #007aff; --apple-gray-5: #2c2c2e; --apple-gray-6: #1c1c1e;
  --apple-bg: #000000; --apple-bg-elevated: #1c1c1e; --apple-bg-card: rgba(28, 28, 30, 0.72);
  --apple-separator: rgba(84, 84, 88, 0.65);
  --apple-label: #ffffff; --apple-label-2: rgba(235, 235, 245, 0.6); --apple-label-3: rgba(235, 235, 245, 0.3);
  --apple-red: #ff3b30; --apple-orange: #ff9500; --apple-yellow: #ffcc00;
  --apple-purple: #af52de; --apple-teal: #5ac8fa;
  --selo-coin: #ffcc00; --selo-coin-dark: #e6b800;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3); --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.45); --shadow-xl: 0 20px 50px rgba(0,0,0,0.5);
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 22px; --radius-pill: 980px;
  --player-height: 88px; --blur: saturate(180%) blur(20px);
}

/* ============ RESET ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ============ BODY ============ */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'Inter', sans-serif;
  background: var(--apple-bg); color: var(--apple-label); min-height: 100vh; overflow-x: hidden;
  padding-bottom: calc(var(--player-height) + env(safe-area-inset-bottom, 0px));
  letter-spacing: -0.01em; font-size: 15px; line-height: 1.4;
}

/* ============ ANIMAÇÕES ============ */
@keyframes loading { 0%{width:0%} 50%{width:70%} 100%{width:100%} }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.7} }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes springIn { 0%{opacity:0;transform:scale(0.92)} 60%{opacity:1;transform:scale(1.02)} 100%{transform:scale(1)} }
@keyframes heartBeat { 0%{transform:scale(1)} 30%{transform:scale(1.3)} 60%{transform:scale(0.95)} 100%{transform:scale(1)} }

/* ============ LOADING SCREEN ============ */
.loading-screen { position: fixed; inset: 0; background: var(--apple-bg); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.loading-content { text-align: center; }
.progress-loading { width: 180px; height: 4px; background: var(--apple-gray-5); border-radius: var(--radius-pill); overflow: hidden; margin: 16px auto; }
.progress-loading-bar { height: 100%; background: var(--apple-green); width: 0%; border-radius: var(--radius-pill); animation: loading 1.8s infinite; }

/* ============ MAIN APP ============ */
.main-app { display: none; min-height: 100vh; }

/* ============ HEADER ============ */
.app-header { background: rgba(0, 0, 0, 0.72); backdrop-filter: var(--blur); padding: 12px 20px; border-bottom: 0.5px solid var(--apple-separator); position: sticky; top: 0; z-index: 1000; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
.header-content { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; max-width: 1400px; margin: 0 auto; }
.saldo-display h6 { color: var(--apple-label-2); font-size: 11px; font-weight: 600; text-transform: uppercase; margin-bottom: 2px; }
.saldo-display h4 { color: var(--apple-label); font-weight: 700; margin: 0; font-size: 22px; }
.user-badge { background: var(--apple-green); color: #fff; padding: 6px 14px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; }
#healthBadge { font-size: 11px; padding: 4px 12px; border-radius: var(--radius-pill); background: rgba(28,28,30,0.8); border: 0.5px solid var(--apple-separator); font-weight: 600; }
.selo-badge { display: inline-flex; align-items: center; gap: 6px; background: linear-gradient(135deg, var(--selo-coin), var(--selo-coin-dark)); color: #000; padding: 5px 12px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }

/* ============ SIDEBAR ============ */
.sidebar { position: fixed; top: 0; left: -320px; width: 300px; height: 100vh; background: rgba(28, 28, 30, 0.95); backdrop-filter: var(--blur); border-right: 0.5px solid var(--apple-separator); z-index: 10000; transition: left 0.4s; overflow-y: auto; padding: 20px; }
.sidebar.open { left: 0; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 0.5px solid var(--apple-separator); }
.sidebar-close { background: var(--apple-gray-5); border: none; color: var(--apple-label); font-size: 14px; cursor: pointer; width: 32px; height: 32px; border-radius: 50%; }
.nav-menu { list-style: none; padding: 0; }
.nav-item { margin-bottom: 2px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 14px; color: var(--apple-label); text-decoration: none; border-radius: var(--radius-md); font-size: 15px; font-weight: 500; }
.nav-link:hover { background: rgba(255,255,255,0.06); }
.nav-link.active { background: rgba(52, 199, 89, 0.15); color: var(--apple-green); }
.nav-link i { font-size: 18px; width: 22px; text-align: center; }

/* ============ SEÇÕES ============ */
.section { display: none; padding: 20px; animation: fadeIn 0.4s; }
.section.active { display: block; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-title { color: var(--apple-label); font-weight: 700; font-size: 28px; letter-spacing: -0.03em; margin: 0; }

/* ============ FORMULÁRIOS ============ */
.form-group { margin-bottom: 16px; }
.form-control-custom { background: var(--apple-gray-6); border: 0.5px solid transparent; border-radius: var(--radius-md); color: var(--apple-label); padding: 12px 16px; font-size: 16px; width: 100%; font-family: inherit; }
.form-control-custom:focus { background: var(--apple-gray-5); border-color: var(--apple-green); box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.25); outline: none; }
.form-control-custom::placeholder { color: var(--apple-label-3); }

/* ============ BOTÕES BASE ============ */
.btn-miv { background: var(--apple-green); border: none; border-radius: var(--radius-md); color: #fff; font-weight: 600; padding: 14px 20px; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; font-family: inherit; }
.btn-miv:hover { background: var(--apple-green-light); }
.btn-miv:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-follow { background: transparent; border: 1.5px solid var(--apple-green); color: var(--apple-green); font-weight: 600; padding: 6px 14px; border-radius: var(--radius-pill); font-size: 12px; cursor: pointer; }
.btn-follow.following { background: var(--apple-green); color: #fff; }
.auth-link { color: var(--apple-green); text-decoration: none; font-weight: 500; }

/* ============ SEARCH ============ */
.search-container { position: relative; flex: 1; max-width: 500px; margin: 0 20px; }
#searchForm { display: flex; align-items: center; background: var(--apple-gray-6); border-radius: var(--radius-pill); padding: 5px 5px 5px 16px; }
#searchForm:focus-within { background: var(--apple-gray-5); box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.2); }
.search-icon { color: var(--apple-label-3); font-size: 15px; margin-right: 8px; }
.search-input { flex: 1; background: transparent; border: none; color: var(--apple-label); font-size: 15px; padding: 8px 0; outline: none; font-family: inherit; }
.search-input::placeholder { color: var(--apple-label-3); }
.search-submit-btn { background: var(--apple-green); border: none; border-radius: var(--radius-pill); color: #fff; font-weight: 600; font-size: 13px; padding: 8px 18px; cursor: pointer; }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: rgba(28, 28, 30, 0.98); border: 0.5px solid var(--apple-separator); border-radius: var(--radius-lg); max-height: 400px; overflow-y: auto; z-index: 10000; }
.search-result-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; border-bottom: 0.5px solid var(--apple-separator); }
.search-result-item:hover { background: rgba(255,255,255,0.06); }
.search-result-cover { width: 46px; height: 46px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; background: var(--apple-gray-5); }
.search-result-info { flex: 1; min-width: 0; }
.search-result-title { color: var(--apple-label); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-artist { color: var(--apple-label-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-badge { background: rgba(255, 149, 0, 0.2); color: var(--apple-orange); font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); }
.search-result-badge.normal { background: rgba(52, 199, 89, 0.18); color: var(--apple-green); }
.search-result-badge.artist { background: rgba(0, 122, 255, 0.18); color: var(--apple-blue); }

/* ============ UTILITÁRIOS ============ */
.text-purple { color: var(--apple-purple) !important; }
.text-muted { color: var(--apple-label-2) !important; }
.spin { animation: spin 1s linear infinite; }
.empty-state-actionable { text-align: center; padding: 40px 20px; border: 1px dashed var(--apple-separator); border-radius: var(--radius-xl); margin: 16px 0; }
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }

/* ============ OFFLINE BADGE ============ */
.offline-badge { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); background: rgba(255, 59, 48, 0.92); color: #fff; padding: 8px 18px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; z-index: 10001; display: none; }

/* ============ FOOTER ============ */
.connection-footer { margin-top: 40px; padding: 20px 0; color: var(--apple-label-2); font-size: 12px; display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; border-top: 0.5px solid var(--apple-separator); }

/* ============ STAT CARDS ============ */
.artist-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--apple-bg-card); border: 0.5px solid var(--apple-separator); border-radius: var(--radius-lg); padding: 24px 20px; text-align: center; }
.stat-icon { font-size: 32px; color: var(--apple-green); margin-bottom: 12px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--apple-label); margin: 8px 0; }
.stat-label { color: var(--apple-label-2); font-size: 13px; font-weight: 500; }

/* ============ INFO CARDS ============ */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.info-card { background: var(--apple-bg-card); border: 0.5px solid var(--apple-separator); border-radius: var(--radius-lg); padding: 16px; display: flex; align-items: center; gap: 16px; }
.info-icon { width: 48px; height: 48px; background: rgba(52, 199, 89, 0.15); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.info-icon i { font-size: 22px; color: var(--apple-green); }
.info-label { font-size: 12px; color: var(--apple-label-2); margin-bottom: 4px; text-transform: uppercase; font-weight: 600; }
.info-value { font-size: 22px; font-weight: 700; color: var(--apple-label); }

/* ============ PORTFOLIO ============ */
.portfolio-summary { background: var(--apple-bg-card); border: 0.5px solid var(--apple-separator); border-radius: var(--radius-xl); padding: 28px 24px; margin-bottom: 24px; text-align: center; }
.portfolio-value { font-size: 42px; font-weight: 700; color: var(--apple-green); margin: 8px 0; }

/* ============ LEDGER ============ */
.ledger-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.ledger-table th { background: transparent; color: var(--apple-label-2); font-weight: 600; text-align: left; padding: 12px 16px; border-bottom: 0.5px solid var(--apple-separator); font-size: 12px; text-transform: uppercase; }
.ledger-table td { padding: 14px 16px; border-bottom: 0.5px solid var(--apple-separator); color: var(--apple-label); font-size: 14px; }

/* ============================================================
   INSTALAÇÃO PWA — v9.6.0
   Botão movido para o sidebar (sem balão flutuante)
   ============================================================ */
#installNavItem .nav-link {
  color: var(--apple-green);
}

#installNavItem .nav-link:hover {
  background: rgba(52, 199, 89, 0.15);
}

#installNavItem .nav-link i {
  color: var(--apple-green);
}
