/* Profile Card */
.profile-card {
    background: var(--bg-primary);
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow);
    overflow: hidden;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

/* Profile Header */
.profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.avatar-section {
    flex-shrink: 0;
}

.avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avatar-container i {
    font-size: 80px;
    color: white;
}

.change-avatar-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #10b981;
    border: 3px solid white;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.change-avatar-btn:hover {
    background: #059669;
    transform: scale(1.1);
}

.profile-info {
    flex: 1;
}

.profile-info h2 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: white;
}

.profile-info p {
    opacity: 0.9;
    margin-bottom: 15px;
}

.level-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Streak Section */
.streak-section {
    padding: 40px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.streak-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.streak-section h3 i {
    color: #ff6b6b;
    font-size: 1.8rem;
}

.streak-display-large {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    border-radius: 15px;
    padding: 30px;
    color: white;
}

.streak-current {
    text-align: center;
    margin-bottom: 30px;
}

.streak-number {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 10px;
}

.streak-label {
    font-size: 1.2rem;
    opacity: 0.9;
}

.streak-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.stat-item i {
    font-size: 1.5rem;
    opacity: 0.9;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.streak-message {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    text-align: center;
    font-size: 1.1rem;
    backdrop-filter: blur(10px);
}

/* Profile Form Section */
.profile-form-section {
    padding: 40px;
    border-bottom: 1px solid var(--border-color);
}

.profile-form-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.profile-form {
    max-width: 600px;
    margin: 0 auto;
    /* Center the form */
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.char-count {
    display: block;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Preferences Section */
.preferences-section {
    padding: 40px;
    border-bottom: 1px solid var(--border-color);
}

.preferences-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.preferences-grid {
    display: grid;
    gap: 15px;
    max-width: 600px;
}

.pref-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.pref-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px var(--shadow);
}

.pref-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.pref-info i {
    font-size: 1.3rem;
    color: #667eea;
    width: 30px;
    text-align: center;
}

.pref-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.pref-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.pref-select,
.pref-input {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pref-select:focus,
.pref-input:focus {
    outline: none;
    border-color: #667eea;
}

.pref-input {
    width: 80px;
    text-align: center;
}

/* Account Actions */
.account-actions {
    padding: 40px;
}

.account-actions h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }

    .profile-info h2 {
        font-size: 1.5rem;
    }

    .streak-section,
    .profile-form-section,
    .preferences-section,
    .account-actions {
        padding: 30px 20px;
    }

    .streak-number {
        font-size: 3rem;
    }

    .streak-stats {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .pref-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .avatar-container {
        width: 100px;
        height: 100px;
    }

    .avatar-container i {
        font-size: 60px;
    }

    .profile-info h2 {
        font-size: 1.3rem;
    }

    .streak-number {
        font-size: 2.5rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }
}

.avatar-section {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.avatar-container:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.avatar-container i {
    font-size: 4rem;
    color: white;
}

.avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.change-avatar-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 40px;
    height: 40px;
    background: #667eea;
    border: 3px solid white;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.change-avatar-btn:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Desktop: Improve Grid to be less stacked */
.preferences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 100%;
    /* Fix: Allow full width */
    justify-content: center;
    /* Fix: Center content */
    margin: 0 auto;
    /* Ensure container is centered */
    width: 100%;
}

/* Mobile: Carousel */
@media (max-width: 768px) {
    .preferences-carousel-container {
        position: relative;
        width: 100%;
        padding-bottom: 40px;
    }

    .preferences-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 15px;
        padding: 0 20px 20px 20px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
        /* FIX: Allow scrolling from start */
    }

    .preferences-grid::-webkit-scrollbar {
        display: none;
    }

    .pref-item {
        flex: 0 0 85%;
        /* Shows part of next card */
        scroll-snap-align: center;
        flex-direction: column;
        align-items: flex-start;
        padding: 24px;
        height: auto;
        margin: 0;
    }

    /* Carousel Indicators */
    .carousel-indicators {
        display: flex;
        justify-content: center;
        gap: 8px;
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
    }

    .carousel-indicator {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.2);
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .dark-mode .carousel-indicator {
        background: rgba(255, 255, 255, 0.2);
    }

    .carousel-indicator.active {
        background: var(--primary-color, #667eea);
        transform: scale(1.2);
    }
}

.pref-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.pref-info i {
    font-size: 1.5rem;
    color: #667eea;
    width: 30px;
    text-align: center;
}

html.dark-mode .pref-info i {
    color: #BB86FC;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    flex: 1;
    min-width: 200px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }

    .avatar-container {
        width: 100px;
        height: 100px;
    }

    .avatar-container i {
        font-size: 3rem;
    }
}