/* Friend Action Button Styles
 * Floating action button for player profile pages
 * Cohesive with trophy-case styling
 */

/* ============================================
   FRIEND ACTION CONTAINER
   ============================================ */
.friend-action-container {
    position: relative;
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
}

/* Position within the trophy composite header */
.trophy-composite-header .friend-action-container {
    margin-left: auto;
    flex-shrink: 0;
}

/* ============================================
   BASE BUTTON STYLES
   ============================================ */
.friend-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
}

.friend-action-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.3);
}

.friend-action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.friend-action-btn i {
    font-size: 0.9rem;
}

/* ============================================
   ADD FRIEND STATE (Primary Action)
   ============================================ */
.friend-action-btn--add {
    background: linear-gradient(135deg, var(--trophy-gold), #c49b2e);
    color: #1a1a1a;
    border-color: var(--trophy-gold);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.friend-action-btn--add:hover:not(:disabled) {
    background: linear-gradient(135deg, #e6c349, var(--trophy-gold));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.friend-action-btn--add:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
}

/* ============================================
   REQUEST SENT STATE (Pending - You Sent)
   ============================================ */
.friend-action-btn--pending {
    background: var(--theme-surface-2);
    color: var(--theme-text-secondary);
    border-color: var(--theme-border-color);
}

.friend-action-btn--pending i {
    animation: pulse-gentle 2s ease-in-out infinite;
}

@keyframes pulse-gentle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   ACCEPT/DECLINE STATE (Pending - They Sent)
   ============================================ */
.friend-action-btn--accept {
    background: var(--theme-success);
    color: white;
    border-color: var(--theme-success);
}

.friend-action-btn--accept:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.friend-action-btn--decline {
    background: transparent;
    color: var(--theme-text-secondary);
    border-color: var(--theme-border-color);
}

.friend-action-btn--decline:hover:not(:disabled) {
    background: var(--theme-surface-2);
    color: var(--theme-danger);
    border-color: var(--theme-danger);
}

/* ============================================
   FRIENDS STATE (Already Friends)
   ============================================ */
.friend-action-btn--friends {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.2));
    color: var(--theme-success);
    border-color: var(--theme-success);
    cursor: default;
}

.friend-action-btn--friends i {
    color: var(--theme-success);
}

/* ============================================
   LOADING STATE
   ============================================ */
.friend-action-btn--loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.friend-action-btn--loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--theme-border-color);
    border-top-color: var(--trophy-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   CONFIRMATION MODAL
   ============================================ */
.friend-confirm-modal .modal-content {
    border: 1px solid var(--theme-border-color);
    background: var(--theme-bg-primary);
    border-radius: 12px;
}

.friend-confirm-modal .modal-header {
    background: var(--theme-surface-2);
    border-bottom: 1px solid var(--theme-border-color);
    border-radius: 12px 12px 0 0;
    padding: 1rem 1.25rem;
}

.friend-confirm-modal .modal-title {
    font-weight: 600;
    color: var(--theme-text-primary);
}

.friend-confirm-modal .modal-body {
    padding: 1.5rem;
}

.friend-confirm-player {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--theme-surface-1);
    border: 1px solid var(--theme-border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.friend-confirm-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--trophy-gold);
}

.friend-confirm-avatar-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--theme-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--theme-border-color);
}

.friend-confirm-avatar-placeholder i {
    font-size: 1.5rem;
    color: var(--theme-text-muted);
}

.friend-confirm-info {
    flex: 1;
}

.friend-confirm-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--theme-text-primary);
    margin-bottom: 0.25rem;
}

.friend-confirm-meta {
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
}

.friend-confirm-message {
    color: var(--theme-text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.friend-confirm-modal .modal-footer {
    background: var(--theme-surface-1);
    border-top: 1px solid var(--theme-border-color);
    border-radius: 0 0 12px 12px;
    padding: 1rem 1.25rem;
    gap: 0.75rem;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.friend-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1060;
    animation: slideInUp 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.friend-toast--success {
    background: var(--theme-success);
    color: white;
}

.friend-toast--error {
    background: var(--theme-danger);
    color: white;
}

.friend-toast--info {
    background: var(--theme-info);
    color: white;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 575.98px) {
    .friend-action-container {
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
    }

    .friend-action-btn {
        width: 100%;
        justify-content: center;
    }

    .friend-action-btn--accept,
    .friend-action-btn--decline {
        flex: 1;
    }

    .friend-confirm-player {
        flex-direction: column;
        text-align: center;
    }

    .friend-toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}

/* ============================================
   DARK MODE ENHANCEMENTS
   ============================================ */
[data-bs-theme="dark"] .friend-action-btn--add,
body.dark-mode .friend-action-btn--add {
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}

[data-bs-theme="dark"] .friend-action-btn--add:hover:not(:disabled),
body.dark-mode .friend-action-btn--add:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.5);
}

[data-bs-theme="dark"] .friend-confirm-modal .modal-content,
body.dark-mode .friend-confirm-modal .modal-content {
    background: var(--theme-surface-1);
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .friend-action-btn {
        transition: none;
    }

    .friend-action-btn--pending i {
        animation: none;
    }

    .friend-action-btn--loading::after {
        animation: none;
    }

    .friend-toast {
        animation: none;
    }
}
