/* ============================= */
/*       PROFILE PAGE STYLES      */
/* ============================= */

:root {
    --profile-primary: #667eea;
    --profile-secondary: #764ba2;
    --profile-accent: #f093fb;
    --profile-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --profile-hero-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.15);
    --border-radius: 1.5rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================= */
/*          LOADING STATE         */
/* ============================= */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    visibility: visible;
    transition: var(--transition);
}
.gift-item img {
  width: 80px;        /* фиксированная ширина */
  height: 80px;       /* фиксированная высота */
  object-fit: contain; /* картинка полностью помещается */
  border-radius: 10px; /* немного скруглим */
  display: block;
  margin: 0 auto 8px; /* центрируем и добавим отступ снизу */
}
.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}
.gift-item span {
  display: block;
  text-align: center;
  font-size: 14px;
  color: #444;
}

.loading-content {
    text-align: center;
    color: var(--profile-primary);
}

.spinner-modern {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    border: 4px solid rgba(102, 126, 234, 0.3);
    border-left: 4px solid var(--profile-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================= */
/*         PROFILE HERO          */
/* ============================= */

.profile-main {
    min-height: 100vh;
    padding-top: 80px;
}

.profile-hero {
    position: relative;
    padding: 3rem 0 2rem;
    background: var(--profile-hero-gradient);
    overflow: hidden;
}

.hero-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    opacity: 0.5;
}

.profile-header-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-heavy);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3rem;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.profile-header-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--profile-gradient);
}

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--profile-gradient);
    padding: 4px;
    box-shadow: var(--shadow-medium);
}

.profile-avatar,
.avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #94a3b8;
}

.avatar-status-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: #10b981;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.profile-basic-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-name {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    background: var(--profile-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.profile-username {
    font-size: 1.1rem;
    color: #64748b;
    font-weight: 500;
    margin: 0;
}

.profile-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 500;
}

.profile-location i {
    color: var(--profile-primary);
}

/* Profile Stats */
.profile-stats-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.stat-block {
    text-align: center;
    padding: 1.5rem 1rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
}

.stat-block:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-light);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--profile-primary);
    margin-bottom: 0.25rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* XP Progress */
.xp-progress-container {
    margin-top: 2rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-light);
}

.xp-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
}

.xp-progress-bar {
    height: 12px;
    background: rgba(100, 116, 139, 0.2);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.xp-progress-fill {
    height: 100%;
    background: var(--profile-gradient);
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.xp-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================= */
/*        PROFILE CONTENT         */
/* ============================= */

.profile-content {
    padding: 3rem 0;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.profile-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 3rem;
    align-items: start;
}

.profile-left,
.profile-right {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Profile Cards */
.profile-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(100, 116, 139, 0.1);
}

.profile-card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid rgba(100, 116, 139, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header h3 i {
    color: var(--profile-primary);
    font-size: 1rem;
}

.achievements-count,
.gifts-count {
    background: var(--profile-gradient);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}

.card-content {
    padding: 2rem;
}

/* About Section */
#about-text {
    line-height: 1.7;
    color: #475569;
    font-size: 0.95rem;
    margin: 0;
}

/* Social Links */
.social-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 0.75rem;
    text-decoration: none;
    color: #475569;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid rgba(100, 116, 139, 0.1);
}

.social-link:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-light);
}

.social-link.telegram { border-left: 4px solid #0088cc; }
.social-link.vk { border-left: 4px solid #4c75a3; }
.social-link.instagram { border-left: 4px solid #e4405f; }

.social-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.social-icon.telegram { background: #0088cc; }
.social-icon.vk { background: #4c75a3; }
.social-icon.instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }

/* Video Section */
.profile-video {
    width: 100%;
    border-radius: 0.75rem;
    background: #000;
}

/* Study Statistics */
.study-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.study-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 1rem;
    transition: var(--transition);
    border: 1px solid rgba(100, 116, 139, 0.1);
}

.study-stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-light);
}

.study-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.study-stat-icon.lessons { background: linear-gradient(135deg, #667eea, #764ba2); }
.study-stat-icon.courses { background: linear-gradient(135deg, #f093fb, #f5576c); }
.study-stat-icon.time { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.study-stat-icon.streak { background: linear-gradient(135deg, #fa709a, #fee140); }

.study-stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.study-stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.study-stat-label {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Achievements Grid */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.achievement-item {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(100, 116, 139, 0.1);
}

.achievement-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-light);
}

.achievement-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--profile-gradient);
}

.achievement-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.75rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.achievement-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
}

.achievement-icon i {
    font-size: 1.5rem;
    color: white;
}

.achievement-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    line-height: 1.2;
}

/* Rarity Styles */
.rarity-common { background: linear-gradient(135deg, #94a3b8, #cbd5e1); }
.rarity-rare { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.rarity-epic { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.rarity-legendary { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

/* Gifts Grid */
.gifts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.gift-item {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(100, 116, 139, 0.1);
}

.gift-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-light);
}

.gift-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--profile-gradient);
}

.gift-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.75rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gift-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
}

.gift-icon i {
    font-size: 1.5rem;
    color: white;
}

.gift-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.25rem;
    line-height: 1.2;
}

.gift-from {
    font-size: 0.7rem;
    color: #64748b;
    font-style: italic;
    margin: 0;
}

/* Empty States */
.no-achievements,
.no-gifts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.no-achievements i,
.no-gifts i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-achievements p,
.no-gifts p {
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: #475569;
}

.no-achievements span,
.no-gifts span {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ============================= */
/*         ERROR MODAL           */
/* ============================= */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal.active {
    display: flex;
}

.error-modal-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 3rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-heavy);
}

.error-icon {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.error-modal-content h2 {
    margin: 0 0 1rem;
    color: #1e293b;
}

.error-modal-content p {
    color: #64748b;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: center;
}

/* ============================= */
/*       RESPONSIVE DESIGN       */
/* ============================= */

@media (max-width: 1024px) {
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .profile-header-card {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }
    
    .profile-avatar-section {
        justify-content: center;
    }
    
    .profile-stats-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .profile-main {
        padding-top: 70px;
    }
    
    .profile-hero {
        padding: 2rem 0 1rem;
    }
    
    .profile-header-card {
        padding: 2rem;
    }
    
    .avatar-container {
        width: 100px;
        height: 100px;
    }
    
    .profile-name {
        font-size: 2rem;
    }
    
    .profile-stats-section {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }
    
    .stat-block {
        padding: 1rem 0.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .study-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .achievements-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .gifts-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (max-width: 480px) {
    .profile-header-card {
        padding: 1.5rem;
    }
    
    .profile-avatar-section {
        flex-direction: column;
        gap: 1rem;
    }
    
    .profile-stats-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card-content {
        padding: 1.5rem;
    }
}

/* ============================= */
/*          ANIMATIONS           */
/* ============================= */

.profile-card {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

.profile-left .profile-card:nth-child(1) { animation-delay: 0.1s; }
.profile-left .profile-card:nth-child(2) { animation-delay: 0.2s; }
.profile-left .profile-card:nth-child(3) { animation-delay: 0.3s; }

.profile-right .profile-card:nth-child(1) { animation-delay: 0.2s; }
.profile-right .profile-card:nth-child(2) { animation-delay: 0.3s; }
.profile-right .profile-card:nth-child(3) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.achievement-item,
.gift-item {
    animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}