/* =============================================================================
   Profile Pages Styles - SecDay CTF Platform
   ============================================================================= */

/* =============================================================================
   Profile Page - General
   ============================================================================= */

.profile-page {
    max-width: 900px;
    margin: 0 auto;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 24px;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--accent-green);
}

/* =============================================================================
   Profile Header
   ============================================================================= */

.profile-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 32px;
}

.profile-header-content {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.profile-avatar-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    border: 4px solid var(--border-color);
}

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

.profile-avatar-placeholder {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
}

.visibility-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.visibility-public {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.visibility-private {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.profile-info-section {
    flex: 1;
}

.profile-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.profile-username {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.meta-item svg {
    opacity: 0.7;
}

.nivel-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
}

.nivel-badge.nivel-pro {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.nivel-badge.nivel-gratuito {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.profile-bio {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.profile-bio p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
}

.profile-social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.social-linkedin {
    background: rgba(0, 119, 181, 0.15);
    color: #0077b5;
    border: 1px solid rgba(0, 119, 181, 0.3);
}

.social-linkedin:hover {
    background: rgba(0, 119, 181, 0.25);
    transform: translateY(-2px);
}

.social-github {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.social-github:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.no-social-links {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

.profile-actions {
    display: flex;
    gap: 12px;
}

/* =============================================================================
   Profile Stats Section
   ============================================================================= */

.profile-stats-section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.profile-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.profile-stat-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-green);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2rem;
    line-height: 1;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =============================================================================
   Profile Tip
   ============================================================================= */

.profile-tip {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.tip-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.tip-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tip-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.tip-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.tip-link:hover {
    color: var(--accent-green);
}

/* =============================================================================
   Edit Profile Page
   ============================================================================= */

.edit-profile-page {
    max-width: 700px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.edit-profile-form {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.form-section .section-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.section-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* Photo Upload */
.photo-upload-section {
    display: flex;
    gap: 24px;
    align-items: center;
}

.current-photo {
    flex-shrink: 0;
}

.photo-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--border-color);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview.photo-placeholder {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
}

.photo-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hidden-input {
    display: none;
}

.upload-btn {
    cursor: pointer;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-danger-outline {
    background: transparent;
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-red);
}

/* Form Elements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.social-icon {
    width: 16px;
    height: 16px;
}

.linkedin-icon {
    color: #0077b5;
}

.github-icon {
    color: var(--text-primary);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-main);
    transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-input.readonly {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.input-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: block;
}

.char-counter {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.char-counter.warning {
    color: var(--accent-yellow);
}

/* Toggle Switch */
.visibility-option {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.toggle-container {
    position: relative;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-container input:checked + .toggle-slider {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
}

.toggle-container input:checked + .toggle-slider:before {
    background-color: #fff;
    transform: translateX(24px);
}

.toggle-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toggle-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
}

/* =============================================================================
   Scoreboard Profile Links
   ============================================================================= */

.user-profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.user-profile-link:hover {
    color: var(--accent-green);
}

.user-profile-link.not-public {
    cursor: default;
}

.user-profile-link.not-public:hover {
    color: inherit;
}

.scoreboard-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

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

.scoreboard-avatar-placeholder {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 768px) {
    .profile-header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .profile-info-section {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .profile-meta {
        justify-content: center;
    }
    
    .profile-social-links {
        justify-content: center;
    }
    
    .profile-actions {
        justify-content: center;
    }
    
    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .profile-tip {
        flex-direction: column;
        text-align: center;
    }
    
    .photo-upload-section {
        flex-direction: column;
        text-align: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .profile-header {
        padding: 20px;
    }
    
    .profile-avatar-large {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }
    
    .profile-name {
        font-size: 1.5rem;
    }
    
    .profile-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-section {
        padding: 16px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}


/* =============================================================================
   Sistema de Patentes
   ============================================================================= */

/* Badge inline (perfil meta, scoreboard) */
.patente-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .22rem .65rem;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
    line-height: 1.4;
}

/* Card de destaque (perfil próprio / público) */
.patente-card {
    background: var(--bg-secondary, #111927);
    border: 1px solid var(--border-color, #2d3748);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-bottom: 1.25rem;
}
.patente-card-icon {
    font-size: 2.4rem;
    line-height: 1;
    flex-shrink: 0;
}
.patente-card-info { flex: 1; min-width: 0; }
.patente-card-grupo {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted, #6b7280);
    margin-bottom: .15rem;
}
.patente-card-nome {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: .35rem;
}
.patente-progress-wrap {
    display: flex;
    align-items: center;
    gap: .6rem;
}
.patente-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-card, #1a2332);
    border-radius: 99px;
    overflow: hidden;
}
.patente-progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width .4s ease;
}
.patente-progress-label {
    font-size: .72rem;
    color: var(--text-muted, #6b7280);
    white-space: nowrap;
}
.patente-maxima { font-size: .78rem; color: var(--text-muted, #6b7280); font-style: italic; }

/* ── Cores por grupo ──────────────────────────────────────────────── */

/* Praça — cinza terroso */
.pat-recruta, .pat-soldado, .pat-cabo,
.pat-3sgt, .pat-2sgt, .pat-1sgt, .pat-subtenente {
    --pat-cor: #a78bfa;
    --pat-bg: rgba(120,113,108,.18);
    --pat-border: rgba(120,113,108,.4);
    --pat-fill: #a16207;
}
.pat-recruta  { --pat-cor: var(--text-secondary); --pat-bg: rgba(156,163,175,.12); --pat-border: rgba(156,163,175,.3); --pat-fill: #6b7280; }
.pat-soldado  { --pat-cor: #b0b8c5; --pat-bg: rgba(156,163,175,.15); --pat-border: rgba(156,163,175,.35); --pat-fill: #6b7280; }
.pat-cabo     { --pat-cor: #d1a97e; --pat-bg: rgba(180,140,80,.15); --pat-border: rgba(180,140,80,.35); --pat-fill: #b45309; }
.pat-3sgt     { --pat-cor: #d1a97e; --pat-bg: rgba(180,140,80,.18); --pat-border: rgba(180,140,80,.4); --pat-fill: #b45309; }
.pat-2sgt     { --pat-cor: #e0b97e; --pat-bg: rgba(200,150,80,.2); --pat-border: rgba(200,150,80,.4); --pat-fill: #d97706; }
.pat-1sgt     { --pat-cor: #f0ca7e; --pat-bg: rgba(220,160,80,.2); --pat-border: rgba(220,160,80,.4); --pat-fill: #d97706; }
.pat-subtenente { --pat-cor: #fcd34d; --pat-bg: rgba(252,211,77,.15); --pat-border: rgba(252,211,77,.35); --pat-fill: #d97706; }

/* Oficial Subalterno — verde */
.pat-aspirante, .pat-2ten, .pat-1ten {
    --pat-cor: #6ee7b7;
    --pat-bg: rgba(52,211,153,.12);
    --pat-border: rgba(52,211,153,.3);
    --pat-fill: #059669;
}
.pat-1ten { --pat-cor: #4ade80; --pat-bg: rgba(74,222,128,.14); --pat-border: rgba(74,222,128,.35); --pat-fill: #16a34a; }

/* Oficial Intermediário — azul */
.pat-capitao {
    --pat-cor: #60a5fa;
    --pat-bg: rgba(96,165,250,.13);
    --pat-border: rgba(96,165,250,.35);
    --pat-fill: #2563eb;
}

/* Oficiais Superiores — roxo */
.pat-major, .pat-tencor, .pat-coronel {
    --pat-cor: #c084fc;
    --pat-bg: rgba(192,132,252,.13);
    --pat-border: rgba(192,132,252,.35);
    --pat-fill: #7c3aed;
}
.pat-tencor  { --pat-cor: #d8b4fe; --pat-bg: rgba(216,180,254,.14); --pat-border: rgba(216,180,254,.38); }
.pat-coronel { --pat-cor: #e9d5ff; --pat-bg: rgba(233,213,255,.15); --pat-border: rgba(233,213,255,.4); }

/* Generais — dourado */
.pat-gen-brig, .pat-gen-div, .pat-gen-exe, .pat-marechal {
    --pat-cor: #fbbf24;
    --pat-bg: rgba(251,191,36,.13);
    --pat-border: rgba(251,191,36,.38);
    --pat-fill: #d97706;
}
.pat-gen-div  { --pat-cor: #f59e0b; --pat-bg: rgba(245,158,11,.16); --pat-border: rgba(245,158,11,.42); }
.pat-gen-exe  { --pat-cor: #f97316; --pat-bg: rgba(249,115,22,.15); --pat-border: rgba(249,115,22,.42); --pat-fill: #ea580c; }
.pat-marechal {
    --pat-cor: #fff;
    --pat-bg: linear-gradient(135deg, rgba(251,191,36,.25), rgba(249,115,22,.2));
    --pat-border: rgba(251,191,36,.6);
    --pat-fill: #f59e0b;
}

/* Aplica as variáveis CSS */
.patente-badge {
    color: var(--pat-cor);
    background: var(--pat-bg);
    border-color: var(--pat-border);
}
.patente-card { border-color: var(--pat-border, #2d3748); }
.patente-card-nome { color: var(--pat-cor, #e4e7eb); }
.patente-progress-fill { background: var(--pat-fill, #6366f1); }
