/* ==========================================================================
   FRIENDS SCREEN
   ========================================================================== */

.friends-screen {
    max-width: 520px;
    margin: 0 auto;
    padding: 0 var(--spacing-xs);
}

.friends-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    color: var(--gold);
}

.friends-header h2 {
    font-family: var(--font-pixel);
    font-size: 14px;
    color: var(--text-bright);
    margin: 0;
}

.friends-back-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    font-family: var(--font-pixel);
    font-size: 10px;
}

.friends-back-btn:hover {
    color: var(--text-main);
}

/* --- Tabs --- */

.friends-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: var(--spacing-md);
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    padding: 2px;
}

.friends-tab {
    flex: 1;
    padding: 12px 4px;
    background: none;
    border: none;
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, color 0.15s;
    position: relative;
    min-height: 44px;
}

.friends-tab:hover {
    color: var(--text-dim);
    background: var(--bg-mid);
}

.friends-tab.active {
    background: var(--bg-surface);
    color: var(--gold-light);
}

.friends-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--red);
    color: var(--text-bright);
    font-family: var(--font-pixel);
    font-size: 6px;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    padding: 0 3px;
    margin-left: 4px;
    vertical-align: middle;
}

/* --- Search --- */

.friends-search-wrap {
    margin-bottom: var(--spacing-md);
}

.friends-search-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-mid);
    border: 2px solid var(--border-dark);
    color: var(--text-bright);
    font-family: var(--font-pixel);
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s;
}

.friends-search-input::placeholder {
    color: var(--text-muted);
}

.friends-search-input:focus {
    border-color: var(--gold-dark);
}

/* --- Friend Card --- */

.friend-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-dark);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    min-height: 64px;
}

.friend-card:hover {
    border-color: var(--border-light);
    background: var(--bg-raised);
}

.friend-card:active {
    background: var(--bg-raised);
    border-color: var(--border-light);
}

.friend-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.friend-avatar {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-mid);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-mid);
    image-rendering: pixelated;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-avatar.no-avatar {
    color: var(--text-muted);
}

.friend-avatar.no-avatar svg {
    width: 24px;
    height: 24px;
}

.online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

.online-dot.online {
    background: var(--green-light);
    box-shadow: 0 0 4px var(--green);
}

.online-dot.offline {
    background: var(--text-muted);
}

.friend-info {
    flex: 1;
    min-width: 0;
}

.friend-name {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-rating {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--text-dim);
    margin-top: 4px;
}

.friend-action {
    flex-shrink: 0;
}

/* --- Pending Request Card --- */

.pending-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-dark);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    min-height: 64px;
}

.pending-actions {
    display: flex;
    gap: var(--spacing-xs);
    margin-left: auto;
    flex-shrink: 0;
}

.pending-accept {
    font-family: var(--font-pixel);
    font-size: 9px;
    padding: 10px 16px;
    background: rgba(104, 168, 88, 0.2);
    border: 1px solid var(--green);
    color: var(--green-light);
    cursor: pointer;
    transition: background 0.15s;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pending-accept:hover {
    background: rgba(104, 168, 88, 0.35);
}

.pending-accept:active {
    background: rgba(104, 168, 88, 0.5);
}

.pending-decline {
    font-family: var(--font-pixel);
    font-size: 9px;
    padding: 10px 16px;
    background: rgba(168, 72, 56, 0.15);
    border: 1px solid var(--border-dark);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pending-decline:hover {
    background: rgba(168, 72, 56, 0.3);
    color: var(--red-light);
}

.pending-decline:active {
    background: rgba(168, 72, 56, 0.4);
    color: var(--red-light);
}

/* --- Direction Labels --- */

.pending-direction {
    font-family: var(--font-pixel);
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pending-direction-received {
    color: var(--gold);
}

.pending-direction-sent {
    color: var(--text-muted);
}

/* --- Empty States --- */

.friends-empty {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    color: var(--text-muted);
    font-family: var(--font-pixel);
    font-size: 9px;
    line-height: 2;
}

/* ==========================================================================
   FRIEND PROFILE -- Full page view
   ========================================================================== */

.fp-body {
    padding: var(--spacing-sm) 0;
}

.fp-hero {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-dark);
    margin-bottom: var(--spacing-sm);
}

.fp-avatar {
    width: 72px;
    height: 72px;
    border: 3px solid var(--border-highlight);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-mid);
    flex-shrink: 0;
    image-rendering: pixelated;
}

.fp-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fp-avatar-placeholder {
    color: var(--text-muted);
}

.fp-identity {
    min-width: 0;
    flex: 1;
}

.fp-name {
    font-family: var(--font-pixel);
    font-size: 14px;
    color: var(--gold-light);
    text-shadow: 0 1px 0 rgba(0,0,0,0.5);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fp-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.fp-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fp-online-dot.online {
    background: var(--green-light);
    box-shadow: 0 0 4px var(--green);
}

.fp-online-dot.offline {
    background: var(--text-muted);
}

.fp-online-text {
    font-family: var(--font-pixel);
    font-size: 8px;
}

.fp-online-text.online { color: var(--green-light); }
.fp-online-text.offline { color: var(--text-muted); }

.fp-bio {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--text-dim);
    line-height: 1.8;
    margin-bottom: 4px;
}

.fp-friends-since {
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--text-muted);
}

/* --- Rating bar --- */

.fp-rating-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border: 1px solid var(--border-dark);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.fp-rating-big {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-pixel);
    font-size: 18px;
    color: var(--gold-light);
}

.fp-rating-big .icon { color: var(--gold); }

.fp-record {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fp-record-item {
    display: flex;
    align-items: baseline;
    gap: 3px;
}

.fp-record-value {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: var(--text-bright);
}

.fp-record-value.wins { color: var(--green-light); }
.fp-record-value.losses { color: var(--red-light); }
.fp-record-value.winrate { color: var(--gold-light); }

.fp-record-label {
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.fp-record-sep {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--border-light);
}

/* --- Sections --- */

.fp-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-dark);
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-md);
}

.fp-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--text-bright);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--border-dark);
}

.fp-section-count {
    font-size: 8px;
    color: var(--text-muted);
}

/* --- Top plants grid --- */

.fp-plants-grid {
    display: flex;
    gap: var(--spacing-sm);
}

.fp-plant-card {
    flex: 1;
    text-align: center;
    background: var(--bg-mid);
    border: 1px solid var(--border-dark);
    padding: var(--spacing-sm);
    min-width: 0;
}

.fp-plant-sprite {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing-xs);
}

.fp-plant-name {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.fp-plant-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
}

.fp-plant-rarity {
    font-family: var(--font-pixel);
    font-size: 6px;
    text-transform: uppercase;
}

.fp-plant-rarity.rarity-common { color: var(--rarity-common); }
.fp-plant-rarity.rarity-uncommon { color: var(--rarity-uncommon); }
.fp-plant-rarity.rarity-rare { color: var(--rarity-rare); }
.fp-plant-rarity.rarity-epic { color: var(--rarity-epic); }
.fp-plant-rarity.rarity-legendary { color: var(--rarity-legendary); }

.fp-plant-stars {
    display: inline-flex;
    gap: 1px;
    color: var(--gold);
}

.fp-plant-score {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--gold);
    margin-bottom: 2px;
}

.fp-plant-record {
    font-family: var(--font-pixel);
    font-size: 6px;
    color: var(--text-muted);
}

/* --- Recent matches --- */

.fp-match-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid rgba(58,48,40,0.5);
}

.fp-match-row:last-child {
    border-bottom: none;
}

.fp-match-result {
    font-family: var(--font-pixel);
    font-size: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fp-match-win {
    color: var(--green-light);
    background: rgba(104,168,88,0.12);
    border: 1px solid rgba(104,168,88,0.3);
}

.fp-match-loss {
    color: var(--red-light);
    background: rgba(168,72,56,0.12);
    border: 1px solid rgba(168,72,56,0.3);
}

.fp-match-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fp-match-opponent {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fp-match-date {
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--text-muted);
}

.fp-match-rating {
    font-family: var(--font-pixel);
    font-size: 10px;
    flex-shrink: 0;
}

.fp-match-positive { color: var(--green-light); }
.fp-match-negative { color: var(--red-light); }

.fp-match-forfeit {
    font-family: var(--font-pixel);
    font-size: 7px;
    color: var(--text-muted);
    background: rgba(168,72,56,0.15);
    padding: 2px 4px;
    border: 1px solid var(--border-dark);
}

/* --- Action --- */

.fp-action {
    padding: var(--spacing-sm) 0;
}

.fp-action .btn {
    width: 100%;
}
