/**
 * GridStream Friends Module - Styles
 * Phase 6: Friends & Following System
 * Version: 1.0.0
 * Theme: Red/Yellow Cyberpunk matching main GridStream design
 */

/* ==========================================================================
   Module Container
   ========================================================================== */

.gridstream-friends-module {
    background: linear-gradient(135deg, #1a0a0f 0%, #2a1520 100%);
    border: 2px solid transparent;
    border-image: linear-gradient(90deg, #e63946, #ff8a24) 1;
    border-radius: 20px 0 20px 0;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.gridstream-friends-module::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(230, 57, 70, 0.03) 0px,
        transparent 1px,
        transparent 2px,
        rgba(230, 57, 70, 0.03) 3px
    );
    pointer-events: none;
    z-index: 1;
}

.gridstream-friends-module > * {
    position: relative;
    z-index: 2;
}

/* Guest Message */
.friends-guest-message {
    text-align: center;
    padding: 40px 20px;
    color: #ff8a24;
}

/* ==========================================================================
   Tabs Navigation
   ========================================================================== */

.friends-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.friends-tab-btn {
    flex: 1;
    min-width: 100px;
    background: rgba(230, 57, 70, 0.1);
    border: 2px solid #e63946;
    border-radius: 15px 0 15px 0;
    padding: 12px 15px;
    color: #e63946;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 11px;
}

.friends-tab-btn:hover {
    background: rgba(230, 57, 70, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.3);
}

.friends-tab-btn.active {
    background: linear-gradient(135deg, #e63946, #ff8a24);
    border-color: #ff8a24;
    color: #fff;
    box-shadow: 0 0 20px rgba(230, 57, 70, 0.5);
}

.tab-icon {
    font-size: 18px;
}

.tab-label {
    font-size: 10px;
}

.tab-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    min-width: 20px;
    text-align: center;
}

.friends-tab-btn.active .tab-count {
    background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Tab Content
   ========================================================================== */

.friends-content {
    min-height: 400px;
}

.friends-tab-content {
    display: none;
}

.friends-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Headers
   ========================================================================== */

.friends-header {
    margin-bottom: 20px;
    text-align: center;
}

.friends-title {
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #e63946;
    text-shadow: 0 0 10px rgba(230, 57, 70, 0.5);
    margin: 0 0 10px 0;
}

.friends-subtitle {
    color: #ff8a24;
    font-size: 14px;
    margin: 0;
}

/* ==========================================================================
   Friends Grid
   ========================================================================== */

.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.friend-card {
    background: rgba(30, 15, 20, 0.8);
    border: 2px solid #e63946;
    border-radius: 15px 0 15px 0;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.friend-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(230, 57, 70, 0.4);
    border-color: #ff8a24;
}

.friend-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #e63946;
    flex-shrink: 0;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-info {
    flex: 1;
    min-width: 0;
}

.friend-name {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin: 0 0 5px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Clickable Profile Links */
.friend-avatar-link {
    display: block;
    transition: transform 0.3s ease;
    text-decoration: none;
}

.friend-avatar-link:hover {
    transform: scale(1.1);
}

.friend-avatar-link:hover .friend-avatar {
    box-shadow: 0 0 15px rgba(230, 57, 70, 0.8);
}

.friend-name-link {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.friend-name-link:hover {
    color: #ff8a24;
    text-shadow: 0 0 10px rgba(255, 138, 36, 0.8);
    transform: translateX(2px);
}

.friend-name-link:hover .friend-name {
    color: #ff8a24;
}

.friend-username {
    font-size: 13px;
    color: #ff8a24;
    margin: 0 0 5px 0;
}

.friend-date {
    font-size: 11px;
    color: #999;
    margin: 0;
}

.friend-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.friend-action-btn {
    background: rgba(230, 57, 70, 0.2);
    border: 2px solid #e63946;
    border-radius: 10px 0 10px 0;
    padding: 8px 12px;
    color: #e63946;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.friend-action-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #e63946, #ff8a24);
    border-color: #ff8a24;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(230, 57, 70, 0.4);
}

.friend-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button Variants */
.accept-btn {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4caf50;
    color: #4caf50;
}

.accept-btn:hover {
    background: #4caf50;
    color: #fff;
}

.decline-btn,
.remove-btn,
.cancel-btn {
    background: rgba(244, 67, 54, 0.2);
    border-color: #f44336;
    color: #f44336;
}

.decline-btn:hover,
.remove-btn:hover,
.cancel-btn:hover {
    background: #f44336;
    color: #fff;
}

.message-btn {
    font-size: 16px;
    padding: 8px 12px;
}

.add-btn {
    background: rgba(33, 150, 243, 0.2);
    border-color: #2196f3;
    color: #2196f3;
}

.add-btn:hover {
    background: #2196f3;
    color: #fff;
}

.unblock-btn {
    background: rgba(255, 138, 36, 0.2);
    border-color: #ff8a24;
    color: #ff8a24;
}

.unblock-btn:hover {
    background: #ff8a24;
    color: #fff;
}

/* Request Actions (wider buttons) */
.request-actions {
    flex-direction: column;
    min-width: 100px;
}

.request-actions .friend-action-btn {
    width: 100%;
}

/* ==========================================================================
   Loading & Empty States
   ========================================================================== */

.friends-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #ff8a24;
}

.friends-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(230, 57, 70, 0.2);
    border-top-color: #e63946;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.friends-loading p {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.friends-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 14px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .friends-tabs {
        gap: 5px;
    }
    
    .friends-tab-btn {
        min-width: 80px;
        padding: 10px 8px;
        font-size: 10px;
    }
    
    .tab-icon {
        font-size: 16px;
    }
    
    .tab-label {
        font-size: 9px;
    }
    
    .friends-grid {
        grid-template-columns: 1fr;
    }
    
    .friend-card {
        flex-direction: row;
    }
    
    .friend-actions {
        flex-direction: column;
    }
    
    .request-actions {
        min-width: 90px;
    }
}

@media (max-width: 480px) {
    .gridstream-friends-module {
        padding: 15px;
    }
    
    .friends-tab-btn {
        padding: 8px 5px;
    }
    
    .tab-label {
        display: none;
    }
    
    .friend-card {
        padding: 12px;
    }
    
    .friend-avatar {
        width: 50px;
        height: 50px;
    }
    
    .friend-action-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.friends-tab-btn:focus,
.friend-action-btn:focus,
.search-input:focus,
.search-btn:focus {
    outline: 2px solid #ff8a24;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .friends-tab-btn,
    .friend-card,
    .friend-action-btn,
    .search-btn {
        transition: none;
    }
    
    .friends-tab-content.active {
        animation: none;
    }
    
    .spinner {
        animation: none;
        border-top-color: transparent;
    }
}

/* ==========================================================================
   Settings Tab Styles
   ========================================================================== */

.settings-section {
    background: rgba(26, 10, 15, 0.6);
    border: 1px solid rgba(230, 57, 70, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    color: #ff8a24;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(230, 57, 70, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Privacy Settings */
.privacy-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.privacy-option {
    position: relative;
    cursor: pointer;
    display: block;
}

.privacy-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.privacy-card {
    background: linear-gradient(135deg, rgba(26, 10, 15, 0.8) 0%, rgba(42, 21, 32, 0.8) 100%);
    border: 2px solid rgba(230, 57, 70, 0.3);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ddd;
    font-size: 14px;
}

.privacy-card:hover {
    border-color: #ff8a24;
    background: linear-gradient(135deg, rgba(26, 10, 15, 0.9) 0%, rgba(42, 21, 32, 0.9) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.2);
}

.privacy-option input[type="radio"]:checked + .privacy-card {
    border-color: #e63946;
    background: linear-gradient(135deg, rgba(230, 57, 70, 0.2) 0%, rgba(255, 138, 36, 0.2) 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 20px rgba(230, 57, 70, 0.4);
}

.privacy-card strong {
    display: block;
    font-size: 16px;
    margin-top: 8px;
    color: #ff8a24;
}

.privacy-option input[type="radio"]:checked + .privacy-card strong {
    color: #e63946;
}

/* Featured Friends Section */
.featured-friends-container {
    margin-bottom: 20px;
}

.featured-slots {
    margin-bottom: 25px;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.featured-slot {
    background: rgba(26, 10, 15, 0.6);
    border: 2px dashed rgba(230, 57, 70, 0.3);
    border-radius: 10px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.featured-slot.empty {
    color: #666;
    font-size: 14px;
}

.featured-slot.dragover {
    border-color: #ff8a24;
    background: rgba(255, 138, 36, 0.1);
    border-style: solid;
}

.featured-friend-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px;
    cursor: move;
    width: 100%;
}

.featured-friend-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.featured-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid #e63946;
    object-fit: cover;
}

.featured-name {
    color: #ff8a24;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    word-wrap: break-word;
    max-width: 100%;
}

.featured-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(230, 57, 70, 0.8);
    border: 1px solid #e63946;
    color: #fff;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.featured-remove:hover {
    background: #e63946;
    transform: scale(1.1);
}

/* Available Friends Selector */
.available-friends {
    background: rgba(26, 10, 15, 0.4);
    border: 1px solid rgba(230, 57, 70, 0.2);
    border-radius: 8px;
    padding: 15px;
}

.available-friends h5 {
    color: #ff8a24;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.available-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.available-friend {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: rgba(42, 21, 32, 0.6);
    border: 1px solid rgba(230, 57, 70, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.available-friend:hover {
    border-color: #ff8a24;
    background: rgba(42, 21, 32, 0.8);
    transform: translateY(-2px);
}

.available-friend img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(230, 57, 70, 0.5);
    object-fit: cover;
}

.available-friend span {
    color: #ddd;
    font-size: 11px;
    text-align: center;
    word-wrap: break-word;
    max-width: 100%;
}

/* Save Buttons in Settings */
.settings-section button {
    background: linear-gradient(135deg, #e63946 0%, #ff8a24 100%);
    border: 2px solid #e63946;
    border-radius: 8px;
    color: #fff;
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.settings-section button:hover {
    background: linear-gradient(135deg, #ff8a24 0%, #e63946 100%);
    border-color: #ff8a24;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
    transform: translateY(-2px);
}

.settings-section button:active {
    transform: translateY(0);
}

/* Responsive Settings */
@media (max-width: 768px) {
    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .privacy-options {
        grid-template-columns: 1fr;
    }
    
    .available-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
}

