/**
 * MatematikvaktiNet Profile Styles
 * 
 * @package MatematikvaktiNet
 * @since 1.0.0
 */

/* ==========================================================================
   Variables
   ========================================================================== */
:root {
    --profile-primary: #1E40AF;
    --profile-primary-light: #3B82F6;
    --profile-success: #10B981;
    --profile-warning: #F59E0B;
    --profile-danger: #EF4444;
    --profile-info: #06B6D4;
    --profile-dark: #1F2937;
    --profile-gray: #6B7280;
    --profile-light: #F3F4F6;
    --profile-border: #E5E7EB;
    --profile-radius: 12px;
    --profile-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* ==========================================================================
   Profile Header
   ========================================================================== */
.profile-header {
    position: relative;
    margin-bottom: 30px;
}

.profile-cover {
    height: 250px;
    background: linear-gradient(135deg, var(--profile-primary) 0%, var(--profile-primary-light) 100%);
    border-radius: 0 0 var(--profile-radius) var(--profile-radius);
    position: relative;
    overflow: hidden;
}

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

.profile-cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.3) 100%);
}

.profile-cover-edit {
    position: absolute;
    bottom: 15px;
    right: 15px;
    padding: 8px 15px;
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--profile-dark);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.profile-cover-edit:hover {
    background: #fff;
    transform: translateY(-2px);
}

.profile-info {
    display: flex;
    gap: 25px;
    padding: 0 30px;
    margin-top: -60px;
    position: relative;
    z-index: 1;
}

.profile-avatar-wrapper {
    position: relative;
}

.profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 5px solid #fff;
    box-shadow: var(--profile-shadow);
    overflow: hidden;
    background: #fff;
}

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

.profile-avatar-edit {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--profile-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.profile-avatar-edit:hover {
    transform: scale(1.1);
}

.profile-level-badge {
    position: absolute;
    top: 5px;
    right: -5px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--profile-warning) 0%, #D97706 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.profile-details {
    flex: 1;
    padding-top: 70px;
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 8px;
}

.profile-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--profile-dark);
    margin: 0;
}

.profile-verified {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--profile-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--profile-warning) 0%, #F97316 100%);
    color: #fff;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.profile-username {
    color: var(--profile-gray);
    font-size: 15px;
    margin-bottom: 15px;
}

.profile-bio {
    color: var(--profile-dark);
    line-height: 1.6;
    margin-bottom: 15px;
    max-width: 600px;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: var(--profile-gray);
    font-size: 14px;
}

.profile-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.profile-meta-item svg {
    width: 16px;
    height: 16px;
}

.profile-actions {
    display: flex;
    gap: 10px;
    padding-top: 70px;
}

.profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}

.profile-btn-primary {
    background: var(--profile-primary);
    color: #fff;
}

.profile-btn-primary:hover {
    background: var(--profile-primary-light);
}

.profile-btn-secondary {
    background: var(--profile-light);
    color: var(--profile-dark);
}

.profile-btn-secondary:hover {
    background: var(--profile-border);
}

.profile-btn-following {
    background: var(--profile-success);
    color: #fff;
}

/* ==========================================================================
   Profile Stats
   ========================================================================== */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin: 30px 0;
    padding: 25px;
    background: #fff;
    border-radius: var(--profile-radius);
    box-shadow: var(--profile-shadow);
}

.profile-stat {
    text-align: center;
    position: relative;
}

.profile-stat:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 40px;
    background: var(--profile-border);
}

.profile-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--profile-dark);
    display: block;
}

.profile-stat-label {
    font-size: 13px;
    color: var(--profile-gray);
}

.profile-stat a {
    text-decoration: none;
    color: inherit;
}

.profile-stat a:hover .profile-stat-value {
    color: var(--profile-primary);
}

/* ==========================================================================
   Profile Tabs
   ========================================================================== */
.profile-tabs {
    display: flex;
    gap: 5px;
    padding: 5px;
    background: #fff;
    border-radius: var(--profile-radius);
    box-shadow: var(--profile-shadow);
    margin-bottom: 30px;
    overflow-x: auto;
}

.profile-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--profile-gray);
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.profile-tab:hover {
    background: var(--profile-light);
    color: var(--profile-dark);
}

.profile-tab.active {
    background: var(--profile-primary);
    color: #fff;
}

.profile-tab-count {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.profile-tab:not(.active) .profile-tab-count {
    background: var(--profile-light);
}

.profile-tab.active .profile-tab-count {
    background: rgba(255,255,255,0.2);
}

/* ==========================================================================
   Profile Content
   ========================================================================== */
.profile-content {
    background: #fff;
    border-radius: var(--profile-radius);
    box-shadow: var(--profile-shadow);
    padding: 25px;
    min-height: 400px;
}

.profile-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--profile-border);
}

.profile-content-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--profile-dark);
    margin: 0;
}

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

/* ==========================================================================
   Profile Grid (Posts, Files, Exams)
   ========================================================================== */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.profile-grid-item {
    border: 1px solid var(--profile-border);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
}

.profile-grid-item:hover {
    border-color: var(--profile-primary-light);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ==========================================================================
   Badges Section
   ========================================================================== */
.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.profile-badge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 1px solid var(--profile-border);
    border-radius: 12px;
    width: 140px;
    text-align: center;
    transition: all 0.2s;
}

.profile-badge-card:hover {
    border-color: var(--profile-primary);
    transform: translateY(-3px);
}

.profile-badge-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 10px;
}

.profile-badge-card.common .profile-badge-icon { background: #F3F4F6; }
.profile-badge-card.uncommon .profile-badge-icon { background: #D1FAE5; }
.profile-badge-card.rare .profile-badge-icon { background: #DBEAFE; }
.profile-badge-card.epic .profile-badge-icon { background: #EDE9FE; }
.profile-badge-card.legendary .profile-badge-icon { background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%); }

.profile-badge-name {
    font-weight: 600;
    color: var(--profile-dark);
    font-size: 13px;
    margin-bottom: 5px;
}

.profile-badge-date {
    font-size: 11px;
    color: var(--profile-gray);
}

.profile-badge-locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.profile-badge-locked .profile-badge-icon {
    background: var(--profile-light);
}

/* ==========================================================================
   Followers/Following List
   ========================================================================== */
.profile-user-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-user-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid var(--profile-border);
    border-radius: 10px;
    transition: all 0.2s;
}

.profile-user-item:hover {
    background: var(--profile-light);
}

.profile-user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
}

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

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

.profile-user-name {
    font-weight: 600;
    color: var(--profile-dark);
    text-decoration: none;
    display: block;
    margin-bottom: 3px;
}

.profile-user-name:hover {
    color: var(--profile-primary);
}

.profile-user-meta {
    font-size: 13px;
    color: var(--profile-gray);
}

.profile-user-action {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.profile-user-action.follow {
    background: var(--profile-primary);
    color: #fff;
}

.profile-user-action.following {
    background: var(--profile-light);
    color: var(--profile-dark);
}

/* ==========================================================================
   Edit Profile Form
   ========================================================================== */
.edit-profile-form {
    max-width: 600px;
}

.edit-profile-section {
    margin-bottom: 30px;
}

.edit-profile-section h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--profile-border);
}

.edit-profile-field {
    margin-bottom: 20px;
}

.edit-profile-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--profile-dark);
}

.edit-profile-field input[type="text"],
.edit-profile-field input[type="email"],
.edit-profile-field input[type="url"],
.edit-profile-field input[type="password"],
.edit-profile-field textarea,
.edit-profile-field select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--profile-border);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.edit-profile-field input:focus,
.edit-profile-field textarea:focus,
.edit-profile-field select:focus {
    outline: none;
    border-color: var(--profile-primary);
}

.edit-profile-field textarea {
    min-height: 120px;
    resize: vertical;
}

.edit-profile-field .description {
    font-size: 13px;
    color: var(--profile-gray);
    margin-top: 5px;
}

.edit-profile-avatar {
    display: flex;
    align-items: center;
    gap: 20px;
}

.edit-profile-avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--profile-border);
}

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

.edit-profile-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ==========================================================================
   Settings Page
   ========================================================================== */
.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: #fff;
    border-radius: var(--profile-radius);
    box-shadow: var(--profile-shadow);
    padding: 15px;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--profile-dark);
    transition: all 0.2s;
}

.settings-nav-item:hover {
    background: var(--profile-light);
}

.settings-nav-item.active {
    background: var(--profile-primary);
    color: #fff;
}

.settings-nav-item svg {
    width: 20px;
    height: 20px;
}

.settings-section {
    background: #fff;
    border-radius: var(--profile-radius);
    box-shadow: var(--profile-shadow);
    padding: 25px;
}

.settings-section h3 {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--profile-border);
}

.settings-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--profile-border);
}

.settings-option:last-child {
    border-bottom: none;
}

.settings-option-info h4 {
    margin: 0 0 5px;
    font-size: 15px;
}

.settings-option-info p {
    margin: 0;
    font-size: 13px;
    color: var(--profile-gray);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--profile-border);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--profile-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* ==========================================================================
   Activity Feed
   ========================================================================== */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-radius: 10px;
    background: var(--profile-light);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.exam { background: #DBEAFE; color: var(--profile-primary); }
.activity-icon.file { background: #EDE9FE; color: #7C3AED; }
.activity-icon.badge { background: #FEF3C7; color: var(--profile-warning); }
.activity-icon.social { background: #FCE7F3; color: #EC4899; }

.activity-content {
    flex: 1;
}

.activity-text {
    margin: 0 0 5px;
    color: var(--profile-dark);
}

.activity-text a {
    color: var(--profile-primary);
    font-weight: 500;
    text-decoration: none;
}

.activity-time {
    font-size: 12px;
    color: var(--profile-gray);
}

/* ==========================================================================
   Empty States
   ========================================================================== */
.profile-empty {
    text-align: center;
    padding: 60px 20px;
}

.profile-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--profile-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-empty-icon svg {
    width: 40px;
    height: 40px;
    color: var(--profile-gray);
}

.profile-empty h3 {
    margin-bottom: 10px;
    color: var(--profile-dark);
}

.profile-empty p {
    color: var(--profile-gray);
    margin-bottom: 20px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 992px) {
    .profile-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .profile-stat:nth-child(3)::after {
        display: none;
    }
}

@media (max-width: 768px) {
    .profile-cover {
        height: 180px;
    }
    
    .profile-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0 20px;
        margin-top: -50px;
    }
    
    .profile-avatar {
        width: 100px;
        height: 100px;
    }
    
    .profile-details {
        padding-top: 15px;
    }
    
    .profile-name-row {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .profile-name {
        font-size: 1.5rem;
    }
    
    .profile-meta {
        justify-content: center;
    }
    
    .profile-actions {
        padding-top: 15px;
        justify-content: center;
    }
    
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .profile-stat::after {
        display: none;
    }
    
    .profile-tabs {
        gap: 3px;
        padding: 3px;
    }
    
    .profile-tab {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .profile-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-badges {
        justify-content: center;
    }
    
    .profile-badge-card {
        width: 120px;
        padding: 15px;
    }
    
    .profile-badge-icon {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .profile-stats {
        grid-template-columns: 1fr 1fr;
    }
    
    .profile-stat:nth-child(odd):not(:last-child)::after {
        content: '';
        display: block;
    }
    
    .profile-tab span:not(.profile-tab-count) {
        display: none;
    }
    
    .profile-tab {
        padding: 10px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .profile-stats,
    .profile-tabs,
    .profile-content,
    .settings-nav,
    .settings-section {
        background: #1F2937;
    }
    
    .profile-name,
    .profile-stat-value,
    .profile-content-title,
    .profile-badge-name,
    .profile-user-name {
        color: #F9FAFB;
    }
    
    .profile-grid-item,
    .profile-badge-card,
    .profile-user-item {
        border-color: #374151;
    }
    
    .profile-tab:not(.active) {
        color: #9CA3AF;
    }
    
    .profile-tab:hover {
        background: #374151;
    }
    
    .activity-item {
        background: #374151;
    }
}
